我有一个简单的模型:
班级狗 所有者当我尝试添加两只同一所有者的狗时,我创建了他的主人的第一只狗是空的而第二只狗是主人。
如果狗是最后一个,则始终所有者不为空。
Owner me = new Owner();
Dog doggy = new Dog();
doggy.setOwner(me);
realm.copyToRealmOrUpdate(doggy); //here It has been created Dog doggy and Owner me
Dog jimmy = new Dog();
jimmy.setOwner(me);
realm.copyToRealmorUpdate(jimmy); //here It has been created Dog jimmy and updated Owner me to Dog jimmy
....
RealmResults<Dog> dogs ...
dogs.get(0).getOwner(); //It's null
dogs.get(1).getOwner(); //It's Owner me
为什么不工作?
谢谢!