Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToMany Problem #981

Open
ehaahe opened this issue Jul 23, 2019 · 1 comment
Open

ToMany Problem #981

ehaahe opened this issue Jul 23, 2019 · 1 comment

Comments

@ehaahe
Copy link

ehaahe commented Jul 23, 2019

This is my basic class:

class FamilyBean{
       String memberId;
       String sex;
       String fatherId;
       String motherId;

       List<FamilyBean> children;
}

when sex = man, the value of children's fatherId is parent's memberId , otherwise the value of children's motherId is parent's memberId , how can I define annotation to resolve this problem?

@greenrobot-team
Copy link
Collaborator

It does not really make sense that male children only have a father and females only a parent?

Anyhow, sounds to me like you want two ToOne relationships of a child to its parents.
http://greenrobot.org/greendao/documentation/relations/

-- Check out ObjectBox, our new fast, easy to use database!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants