java - Realm Relationship Many-to-one not work -
i've simple model:
class dog owner owner
and when try add 2 dogs same owner, fist dog i've created owner null , second dog owner.
always owner not null if dog last.
owner me = new owner(); dog doggy = new dog(); doggy.setowner(me); realm.copytorealmorupdate(doggy); //here has been created dog doggy , owner me dog jimmy = new dog(); jimmy.setowner(me); realm.copytorealmorupdate(jimmy); //here has been created dog jimmy , updated owner me dog jimmy .... realmresults<dog> dogs ... dogs.get(0).getowner(); //it's null dogs.get(1).getowner(); //it's owner me
why not work?
thanks!!
Comments
Post a Comment