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

Foreign key null for @ToMany #592

Closed
lazarvgd opened this issue Feb 24, 2017 · 4 comments
Closed

Foreign key null for @ToMany #592

lazarvgd opened this issue Feb 24, 2017 · 4 comments

Comments

@lazarvgd
Copy link

lazarvgd commented Feb 24, 2017

I have problem with foreign key in cascade data structures.

Let's say that we have Class A that has List of Class B;

@ToMany(referencedJoinProperty="aId")
List<B> listB;

If I export the DB from device I can observe that table B has column aId but all records have null value for this field, instead it needs to be populated with id of object A.

Also all id's are predefined(objects are created from JSON).

EDIT:
Also Class B has a filed

@Id
Long aId;

Please advice,
Thanks

@wanyt
Copy link

wanyt commented Mar 2, 2017

Have you solve the problem? I have seen this today.

@lazarvgd
Copy link
Author

lazarvgd commented Mar 2, 2017

No, did not find the solution for this

@greenrobot-team
Copy link
Collaborator

If I understand this correctly, make sure to actually insert the entities your class A has a reference to. See the add new related entities part in Resolving and Updating To-Many Relations.
-ut

@greenrobot-team greenrobot-team self-assigned this Mar 14, 2017
@greenrobot-team
Copy link
Collaborator

No response. Closing. -ut

@greenrobot-team greenrobot-team removed their assignment Apr 11, 2017
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

3 participants