Hi, I have following classes. I am creating a country object first and it get persisted, then i read its key field and i get some value. Basically i start a transaction and persist it close/commit the transaction.
then i create a State and set Country for state object as the country(reload the country in this transaction) i just created. After i save State object using pm.makePersistent(state); I try to read id field(Key) from state object, but its coming as null and data(state object) is not persisting. Can you please advise me if i am doing anything wrong. Following are the classes @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Country implements BaseObject{ @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key id; @Persistent private String name; @Persistent private long stateCount; @Persistent(mappedBy = "country") private List<State> states; } @PersistenceCapable(identityType = IdentityType.APPLICATION) public class State implements BaseObject{ @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key id; @Persistent private String name; @Persistent private Country country; @Persistent(mappedBy = "state") private List<District> districts; } public interface BaseObject { public Key getId(); public void setId(Key id); } Thanks, Ravi --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---