0
我有两个类:拥有一一对多关系
public class Dog {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent(mappedBy = "dog")
@Element(dependent = "true")
private List<Toy> toys;
}
public class Toy {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private Name name;
@Persistent
private Dog dog;
}
1)如果我这样做
Toy toy = new Toy();
toy.setDog(dog); // dog is a Dog class
pm.makePersistent(toy);
我可以从狗通过这个getToys玩具()?
2) 如果我这样做两次
Toy toy = new Toy();
toy.setName("AAA");
toy.setDog(dog);
pm.makePersistent(toy);
将两个完全相同的玩具在datestore翻番?
谢谢!