Owned relationships are a bit weird in my opinion. I was having your
same issue. I had a `MyImage` class that was defined inside two
different classes. This didn't work... I didn't quite understand why
and so to avoid all weirdness I decided that for more complex
relationship cases I would always use unowned relationships (defining
the Key of the reference object instead of the object itself).

So I only use owned relationships when the child object can only exist
under 1 (and only 1) parent.

Hope this helped... it's only what I experienced... I'm not a JDO expert.

    Luca

On Tue, May 3, 2011 at 10:51 PM, Muhammad Ijaz Khan <[email protected]> wrote:
> Hi,
> I am building an application and have used JDO for datastore for
> implementing use cases. Now when I am implementing the backend machine which
> is a bit complex in relationships among objects then I am facing hard times
> with JDO (May be due to lack of my knowledge). I have following questions to
> ask,
> 1. Can I use reference of objects in more than one classes? For example,
> Class A is persistent and being used as foreign key in Class B and Class C.
> Do I need to create unowned relationships through Key or can I use some
> annotation (or something) to mark a field of type A as foreign key? When I
> make a field of type A in class B, and assign an object of class A to it, it
> is stored as new object as child of B :s
> 2. Can I use objectify for this use case only (mixing with jdo) and will it
> simplify stuff or not, any experience comment?
> Thanks in advance.
> regards
> Ijaz
>
> --
> 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.
>

-- 
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.

Reply via email to