I cannot get child entities to load as soon as they are saved in Google App Engine. I am sure that they save, because I can see them in the data warehouse. For example, if I have the following two objects.
public class Parent implements Serializable{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true") private String key; @OneToMany(cascade=CascadeType.ALL) private List<Child> children = new ArrayList<Child>();
I can save the parent and child only with the following:
Parent parent = new Parent(); Child child = new Child(); child.setName("Child Object"); parent.getChildren().add(child); em.persist(parent);
However, when I try to load the parent, and then try to access the children (I know that GAE is lazy loading), I do not get the child entries.
//parent already successfully loaded parent.getChildren.size(); // this returns 0
I looked at the textbook after the textbook, and so far nothing has worked. I am using version 1.3.3.1 of the SDK. I have seen the issue mentioned in various blogs and even App Engine forums, but the answer is always JDO related. Am I doing something wrong, or did someone else have this problem and solve it for JPA?
source share