Thank you so much for your answer Bill
yes you are rite the way i wrote its many to many relation.Actually I
want relation as below
class User{
Long id;
String username;
List<Work> workList;
}
class Work{
Long id;
String workname;
String username;
}
you can see work class has username and user class too has username.In
both classes primary key is id. I just want to know is there any way to get
workList populated automatically on retrieval of user object.we can do it
with 2 queries easily.we can reteriev user first then we can retrieve work
object with second query.
On Wed, Jun 2, 2010 at 10:35 PM, Bill Milligan <[email protected]>wrote:
>
> Are you trying one-to-many or many-to-many? By using a third table it
> sounds like you're trying to do many-to-many, not one-to-many.
>
> As best I can determine, the only real way to do this in GAE is to have a
> User class with a collection of string properties, containing the list of
> all Work ids. In this case a bidirectional link would be probably quite
> useful, so that a Work could be identified by its User id.
>
> Here's a scenario: Retrieve User by user id. Then, retrieve all Works in
> the list of work ids owned by the User.
>
> Note that this is not true object composition, with a User containing a
> List of Collection, but rather an indirect reference. This pattern is
> useful in a lot of circumstances where you want to be able to break up your
> object model into more modular deployable applications. On the other hand,
> I'd hate to be completely boxed in by this restriction.
>
> I'm just getting started with GAE so I'm very much not an expert. I'd love
> to know anybody else's thoughts on the matter.
>
> On Wed, Jun 2, 2010 at 12:10 AM, RAVINDER MAAN <[email protected]>wrote:
>
>> Hello all
>> can anybody please tell me how to implement simple one many
>> relation in java.I have user table and work table .Any user can do
>> many type of works.In user table i have userid but it is not primary
>> key of the user table.Then i have work table which has workid it is
>> also not primary key of the table.Normally in relation db we ca make
>> third table table which contains workid for every userid.What how can
>> we implement this thing appengine datastore.I want to have collection
>> all works in user object .can anybody please tell me how to define
>> this mapping?please note that in userid and workid are not primary
>> keys in both objects or tables.
>> Thanks in adavance.
>>
>> --
>> 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]<google-appengine-java%[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]<google-appengine-java%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
--
Regards,
Ravinder Singh Maan
--
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.