greenDAO
greenDAO copied to clipboard
ToMany Problem
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?
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!