Siddharth,
I am not really familiar with GAE-Java, but I have a couple
questions about your "sample code."
1) You say the relation ship is "unowned" which I assume means
neither entity is the "parent" of the other. What do you mean by
"start transaction"? In GAE-Python entities must be in the same
entity group within a transaction or it will fail.
2) If you are using ReferenceProperties, you need to have user
defined key names / ids or an entity should be saved before it could
be referenced by a reference property.
3) I do not see you persisting the User entity in your mock code.
The best design for the relationship will depend on how you are going
to use the data. One alternative to OvermindDL's cross-reference
table design would be list properties. Particularly if tours will
have limited references to a "small" number of Users, just add the
users to a list of of db.keys. If you will have a lots of users make
the list a separate kind and it will be efficient too. Search for
Brett Slatkin's Building Scalable Apps talk from Google io 2008.
Robert
On Tue, Jan 19, 2010 at 12:49 AM, Siddharth Patnaik
<[email protected]> wrote:
> Hi Guys,
> This is an urgent issue for me. Can anyone of you please respond to
> this question? If the question is not clear or more info is required
> please let me know
>
> regards,
> Siddharth
>
> On Jan 17, 7:07 pm, Siddharth Patnaik <[email protected]> wrote:
>> Hi,
>> I have the following situation. I have 2 entities User and Tour and i
>> wanted to have unowned relationship between these two. I have followed
>> the the relationships article on GAE documentation. I am taking care
>> of relationships at both the ends. However my problem is that only one
>> side of the relationship is getting persisted. Here is my sample code:
>>
>> create a persistence manager, pm
>> start transaction
>> create Tour object
>> set the values for this object
>> add a user object //as part of this i am also adding the tour object
>> to the user object
>> pm.makePersistent(tour);
>> commit the transaction
>>
>> My problem is, the user object is never getting updated (with tour
>> relationship info)
>> How do i achieve this?
>
> --
> 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.
>
>
>
>
--
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.