Sorry, what I meant is this. Child c = new Child(); ParentA a = new ParentA(); ParentB b = new ParentB(); a.setChild(c); // child c is in a b.setChild(c); // child c is also in b
And then, can I do this? ParentA a = pm.getObjectById(ParentA.class, keyA); Child c = a.getChild(); // automatically fetched. ParentB b = pm.getObjectById(ParentB.class, keyB); Child c = a.getChild(); // also automatically fetched. On Mar 2, 11:17 am, "Ikai L (Google)" <[email protected]> wrote: > If a Child object is owned by many "Parents", then the Child is actually the > Parent, and this is possible. Parent-Child relationships are defined in the > Key of the objects themselves. If you decoded a Key, it would look something > like this: > > Parent(1)/Child(5) -> Some Child object with ID 5 > Parent(2)/Child(4) -> Some Child object with ID 6 > > This it is not possible for a Child to have multiple parents (though it is > possible to have multiple grandparents). > > > > On Tue, Mar 2, 2010 at 10:45 AM, anjolight <[email protected]> wrote: > > Hi, I am trying to see if below schema is possible in JDO. I read the > > relationship documentation below but I was not sure if this schema > > (Owned many-to-one ?) is possible. I'd appreciate your expert advise. > > >http://code.google.com/intl/en/appengine/docs/java/datastore/relation... > > > Example: > > > Child { > > Key key; > > } > > > ParentA { > > Child child; > > } > > > ParentB { > > Child child; > > } > > > And do this: > > Child c = new Child(); > > ParentA a = new ParentA(); > > ParentB b = new ParentB(); > > a.setChild(c); > > > Eventually I want to load "a" object with object "c" automatically > > fetched. Can I do it like this? > > > Parent A { > > �...@persistent(defaultFetchGroup = "true") > > Child child; > > } > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google App Engine" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<google-appengine%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/google-appengine?hl=en. > > -- > Ikai Lan > Developer Programs Engineer, Google App > Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine -- You received this message because you are subscribed to the Google Groups "Google App Engine" 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?hl=en.
