To answer your questions, why not try something like the code snippet below?
Cheers, Ian @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true") public class User { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true") private String sEncodedKey; /* // This is optional, but I use it. @Persistent @Extension(vendorName="datanucleus", key="gae.pk-id", value="true") private Long loKeyID; */ /* // This is optional. // One cannot define both a "gae.pk-id" and a "gae.pk-name" in the same class. @Persistent @Extension(vendorName="datanucleus", key="gae.pk-name", value="true") private String sKeyName; */ // Even though this field is an array list, the accessor methods // for this field treat the relationship of this class with the child class // as 1-1 (not 1-N). // This is a work-around for datanucleus-appengine issue 165: " // Relation.ONE_TO_ONE_BI NPE postInsert(PersistenceCapableMapping.java:1039)" @Persistent(mappedBy="userParent") @Element(dependent="true") @Order(extensions = @Extension(vendorName="datanucleus", key="list- ordering", value="sEncodedKey ASC")) private ArrayList<FavAnimal> faFavAnimals = new ArrayList<FavAnimal>(); public FavAnimal getFavAnimal() { FavAnimal faFavAnimal = null; if ((faFavAnimals != null) && (!faFavAnimals.isEmpty())) faFavAnimal = faFavAnimals.get(0); return faFavAnimal; } public void setFavAnimal(FavAnimal favAnimal) { if (faFavAnimals == null) faFavAnimals = new ArrayList<FavAnimal>(); if (!faFavAnimals.isEmpty()) faFavAnimals.clear(); if (faFavAnimals != null) faFavAnimals.add(favAnimal); } ... } @PersistenceCapable(identityType = IdentityType.APPLICATION, detachable = "true") public class FavAnimal { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) @Extension(vendorName="datanucleus", key="gae.encoded-pk", value="true") private String sEncodedKey; @Persistent(dependent="false") private User userParent; ... } FavAnimal fa = new FavAnimal(); user.setFavAnimal(fa); fa.setUserParent(user); pm.makePersistent(fa); -- 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-j...@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.