Hi, I think that you have to go for an unowned 1-to-many relationship to achieve what you want else your child is stuck with its 1st parent.
See for samples:http://code.google.com/appengine/docs/java/datastore/ relationships.html#Unowned_Relationships didier On Jul 17, 10:44 pm, max <[email protected]> wrote: > Hi, > > I'm having trouble getting JDO work in a situation of wanting to > transfer child objects from one parent to another. Let's say that I > would like to model an object called "Team" and an object called > "Player". A Player can be on only one team at a time, and a Team can > have many Players. I can get the basics working, however I run into > problems when I want to transfer ("trade") an existing Player instance > to an existing Team instance. Outside of that relationship, the > objects are completely different. > > I have the problem that a child cannot be moved because apparently it > isn't in the same entity group. I have tried to model it as Set<Key> > in each class like the Favorite Foods example in the documentation, > but that doesn't work. I don't get errors, but nothing is saved. The > Sets saved are always empty. I have tried the same thing with > ArrayList<Long>, where Long is the Key.getId() of the related > object. > > I think I am missing something rather simple, but I can't get it > working. Do I need other annotations? Can someone post a simple > example? > > thanks! > Max -- 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.
