In the GAE documentation where unowned relationships are described, see 
REFERENCES link, an interesting example is given using the concepts of 
Person, Food and Favorite Food.
The most relevant thing about this example is detail concerning the fact 
that Food and Person correspond to independent peristence groups.

The one thing I fail to uderstand is why would GAE need to update two 
entity groups during a call to persist?

Reasoning for doubt:
(a) person and food exist in different entity groups (OK - potential for 
problem)
(b) person has a reference to food which it calls favoriteFood (OK - 
potential for problem)
(c) this relationship is unowned (Should resolve potential for problem from 
this point persisting a Person should no longer try to affect the FOO 
persistence group) 
(d) Food does not even have any collection, e.g. Set<Person> 
foodFans,  pointing to Persons  (not that it matters // it would only be 
absoluetly inefficient trying to naviagte from FOOD to food people that are 
food fans) // any Pseudo Forein Key should be saved on the PERSON 
persistence group and not elsewhere)

For all this,
I fail to understand how is it possible that GAE throws the exception 
discussed in the documentation:
javax.jdo.JDOException: cross-group transaction need to be explicitly 
specified, see TransactionOptions.Builder.withXGfound both Element {
??


I am having just this problem.
I have Cashflows that belong to a User persistence group wish explode when 
I try to persistent because they UNOWN a UNI-DIRECTIONAL relationship to a 
CashFlowCateory entity that exists in a persistence group of its own.
I fail to undestand why cashflow would want to update the CashflowCategory 
persistence group.

The way I see it, with the Unowned annotation saying
Key favoriteFood;
or 
@Unowned
Food favoriteFood; should be absoletly identical.
The latter being more convenient, though. 


REFRENCE:
https://developers.google.com/appengine/docs/java/datastore/jdo/relationships

Relevant quote:
"In this example, we give Person a member of type Key, where the Key is the 
unique identifier of a Food object. If an instance of Person and the 
instance of Food referred to byPerson.favoriteFood are *not* in the same 
entity group, you cannot update the person and that person's favorite food 
in a single transaction unless your JDO configuration is set to enable 
cross-group (XG) 
transactions<https://developers.google.com/appengine/docs/java/datastore/transactions#Cross_Group_Transactions>
.
"

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/zpFIoc9aVgMJ.
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.

Reply via email to