Just a quick addition: you actually have something in between an owned and unowned one-to-many because you're holding on to object references to your many.
The unowned one-to-many would use Set<Key> childrenKeys, for example. On Jun 6, 2:38 am, mscwd01 <mscw...@gmail.com> wrote: > To add to my last comment I could do: > > pm.deletePersistentAll(children) > > to delete all Child objects in the Parents children Set, however as > the method deletePersistentAll has a void return type how do you > ensure all Child objects have been deleted before I delete the Parent > entity? > > On Jun 6, 10:12 am, mscwd01 <mscw...@gmail.com> wrote: > > > > > > > > > Thanks for the replies. > > > @Didier - I have considered this, and I guess I will have to manually > > delete each entity if I cant find a more elegant solution, however > > going by what the documentation says it should just work. I'd like to > > find out why this exception is occurring if possible. > > > @Nichole - I currently have an unowned one to many relationship and > > don't really need an owned one, having said that could this make a > > difference? I will have to try and see when I get time. > > > Thanks again > > > On Jun 6, 5:27 am, Didier Durand <durand.did...@gmail.com> wrote: > > > > Hi, > > > > As a workaround, why don't you delete each entity in the set in a loop > > > by yourself before deleting the entity which the set is part of ? > > > > regards > > > > didier > > > > On Jun 6, 1:48 am, mscwd01 <mscw...@gmail.com> wrote: > > > > > Hey, > > > > > I have a "parent" entity which has a Set of "child" entities, as > > > > follows: > > > > > class Parent { > > > > > @Persistent @Element(dependent = "true") > > > > private Set<Child> children; > > > > > } > > > > > When I delete the "Parent" entity I get the following exception: > > > > > javax.jdo.JDOUserException: Cannot read fields from a deleted object > > > > FailedObject:com.google.appengine.api.datastore.Key:Parent("100034534545656 > > > > 7676")/ > > > > Child(2) > > > > > It seems JDO deletes the "Parent" entity before the "Child" objects in > > > > the dependent Set property, which causes the above exception to appear > > > > when the Child entities in the Set are themselves deleted. Does anyone > > > > know how to solve this issue? > > > > > FYI when I delete the parent entity I use pm.deletePersistent() within > > > > a transaction. > > > > > Thanks -- 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.