Hi Jason and Max, I was making some tests on this today and I've found out that one-to-many relationship child objects retrieving works as long as the one-to-many relationship doesn't involve polymorphisms. For example, if we make the Child class abstract and save subclasses into the list the retrieving fails. In the following the snippet that fails. Is this a bug? Am I doing something wrong?? Thanks ----------------------- String parentId = "test"; PersistenceManager pm = PMF.get().getPersistenceManager(); pm.currentTransaction().begin(); Parent parent = new Parent(); Child subChild = new SubChild(); subChild.setParentId(parentId); parent.getChilds().add(subChild); pm.makePersistent(parent); pm.currentTransaction().commit(); pm.close(); pm = PMF.get().getPersistenceManager(); parent = pm.getObjectById(Parent.class, parentId); assertEquals(1, parent.getModules().size()); pm.close(); ----------------------- ----------------------- public abstract class Child implements Serializable { private static final long serialVersionUID = -5125563546796512541L; @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true") protected String encodedKey; @Persistent @Extension(vendorName="datanucleus", key="gae.pk-name", value="true") protected String parentId; [...] } @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable="true") public class SubChild extends Child { private static final long serialVersionUID = 521265701642620882L; @Persistent(defaultFetchGroup="true") private String name; } ---------------------- Jason (Google) wrote: Max is right, although there's a small issue with the syntax: --
Patrizio Munzi --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~----------~----~----~----~------~----~------~--~--- |
- [appengine-java] Failing to retrieve child-objects in a ... Lars
- [appengine-java] Re: Failing to retrieve child-obje... Max Zhu
- [appengine-java] Re: Failing to retrieve child-... Jason (Google)
- [appengine-java] POLYMORPHISM: Failing to r... Patrizio Munzi
- [appengine-java] Re: POLYMORPHISM: Fail... Patrizio Munzi
- [appengine-java] Re: POLYMORPHISM:... Max Ross (Google)