My understanding is an entity with no parent is essentially its own entity 
group.

If you're trying to use multiple entity groups within a transaction, you 
must use a cross-group transaction, and you're limited to 5 entity groups 
(ie, 5 entities) within a transaction.  Beyond that you have to restructure 
your entities to get within that limit.



On Thursday, October 11, 2012 8:32:58 AM UTC-4, Olivier Truemat wrote:
>
> *Richard,*
>
> Thanks for your feedback.
>
> *Ian,*
>
> Yes you are right, I should have posted this one on Stackoverflow. Thanks 
> for letting me know, will take care for the next post.
>
> While executing the transaction on a single entity which has no parent, I 
> received an exception stating that only ancestor queries are allowed in 
> transactions. Do you suggest that I am getting this exception because I am 
> accessing the datastore through Objectify but I wouldn't have the issue 
> going through JDO ?
>
> Thanks,
>
> Olivier
>
>
>
> On Thursday, October 11, 2012 1:16:56 PM UTC+2, Ian Marshall wrote:
>>
>> You say 
>>
>> "... I have to perform datastore transactions on 
>> entities which have no parent. Unless I misunderstood, this is not 
>> possible." 
>>
>> Even though, in my view, this topic should be discussed on 
>> StackOverflow instead of here, I disagree with what you say; this 
>> **is** possible. 
>>
>> My application exchanges data with the datastore using transactions 
>> (and JDO), which can involve persistent entities that do not have an 
>> entity parent. (As we know, every persistent entity group must contain 
>> exactly one entity which has no entity parent.) 
>>
>>
>> On 11 Oct, 10:00, Richard Watson <[email protected]> wrote: 
>> > Yup, that's fine. I believe the datastore will always allow keys to 
>> > entities that don't exist, because it doesn't attempt to maintain 
>> > referential integrity between entities.  There are no cascading 
>> deletes, 
>> > say.  There's no other solution I'm aware of, and this is pretty 
>> central to 
>> > the datastore so I doubt there will be a different mechanism. When you 
>> need 
>> > consistency, provide an ancestor. When you don't, don't. 
>> > 
>> > Just a reminder that that there's a rate limit on entities with the 
>> same 
>> > ancestor, so don't use the same one if you're likely to get multiple 
>> > simultaneous writes as your app grows in popularity. 
>> > 
>> > Richard 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > On Thursday, October 11, 2012 9:43:31 AM UTC+2, Olivier Truemat wrote: 
>> > 
>> > > Hi, 
>> > 
>> > > For a given application, I have to perform datastore transactions on 
>> > > entities which have no parent. Unless I misunderstood, this is not 
>> possible. 
>> > 
>> > > In order to avoid creating dummy entities in the datastore, I am 
>> creating 
>> > > a "fake ancestor" key to an entity that does not exists in the 
>> datastore. 
>> > 
>> > > I would have two questions related to this : 
>> > 
>> > > --> Is there any other solution to have transactions with no entity 
>> being 
>> > > the parent ? 
>> > > --> Will this solution be supported in the long-term by Google ? Just 
>> > > would like to avoid being in a dead-end when an upgrade is 
>> rolled-out. 
>> > 
>> > > public class AAA { 
>> > 
>> > >     @Parent Key<AAA> ancestorKey; // This is a hack to make sure we 
>> can 
>> > > support transactions 
>> > >     @Id     Long Id; 
>> > >     // OTHER FIELDS 
>> > 
>> > >     public static Key<AAA> getAncestorKey() { 
>> > >         return( new Key<AAA> (AAA.class, new Long("1"))); 
>> > >     } 
>> > > } 
>>
>

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