In the first case, you have an unowned one to many and the children are not persisted with pm.makePersitent(item);
If the 2nd case, when Item owns Child entities, pm.makePersistent(item) will persist the children too, but you will have exceptions it you try to persist another item with the same children. If you wanted a hierarchical data structure, you could create a graph of entities with references to children and parent. you'd be missing the cascade delete and insert features of owned one to may relationships though. On Aug 2, 11:49 pm, Ian Marshall <[email protected]> wrote: > I don't think that we can help you unless we see some of your code > where you do your persisting! (Am I correct to presume that you are > using JDO?) > > On Aug 2, 2:28 pm, Sachin Salunkhe <[email protected]> wrote: > > > > > > > > > I am trying to save and retrieve data in google app engine in > > hierarchical manner. > > > 1. > > > In such a case ,where I am using key's for reference to another entity > > (i.e parent --> child) > > > @PersistenceCapable(identityType = IdentityType.APPLICATION, > > detachable = "true") public class Item { > > > @PrimaryKey > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > private Key key; > > > @Persistent > > private List<Key> childs; > > > // > > > } > > > there is no replication of data. > > > Is it possible that child entities get saved automatically when parent > > is saved in above case where I am using Keys ? > > > 2. > > > If I tried same without keys .. > > > @PersistenceCapable(identityType = IdentityType.APPLICATION, > > detachable = "true") public class Item { > > > @PrimaryKey > > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > > private Key key; > > > @Persistent > > private List<Child> childs; > > > // > > > } > > > In this case when I saved parent entity then child's also get saved > > automatically . But then there is replication of data i.e for > > different child's of same parent there are separate copies of > > parent's. > > > Can anybody give me some Ideas and Links ?? -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.
