Hey Jeff,
  Here's a summary of what is happening: 1) open a transaction and
insert two transactional tasks, 2) each of the newly inserted tasks
inserts two transactional tasks.  When the two new tasks run, the
transactions happen within the 'same entity group' (which was never
set because there are *no* datastore operations) causing the
concurrent modification exception when inserting the next set of
tasks.

  So one easy solution to this is to do a datastore operation (like a
fetch by key) to set a unique entity group.  The question is, is there
a way in the Java SDK or Objectify to set the entity group without the
need to actually perform a datastore operation.  I know how to do this
in Python, but I'm not familiar enough with the Java SDK or Objectify
to know if it is possible.


Robert






On Mon, Apr 25, 2011 at 14:17, Jeff Schnitzer <[email protected]> wrote:
> I really don't understand what's being asked.
>
> You don't manually set an entity group; the rule is the same for
> low-level datastore transactions - for any txn, you can only access
> one entity group.  You get exceptions when you violate this rule.
>
> An Objectify (class) instance is created with a transactional context.
>  Want a new transaction?  Create a new instance.  You can't recycle
> them.  If there's something confusing about the documentation, let me
> know.
>
> Jeff
>
> On Sat, Apr 23, 2011 at 7:58 AM, Robert Kluin <[email protected]> wrote:
>> Hey Matija,
>>  I'm not familiar with Objectify's source, but perhaps Jeff could
>> suggest a simple / more efficient way to set the connection's entity
>> group for Java apps.
>>
>>
>>  For Python apps it is possible to get the transaction connection
>> object then 'manually' set the entity group; however, you need to use
>> 'internal' methods / attributes to do that (at least with the
>> interface I'm familiar with).
>>
>>
>>
>> Robert
>>
>>
>>
>>
>> On Sat, Apr 23, 2011 at 15:59, Matija <[email protected]> wrote:
>>> Hi Robert. Bravo. This approach solved problem.
>>> We are using objectify and for quick test reason I have used this to set
>>> this internal 'connection' entity group:
>>> try {
>>>      dao.ofy().getDatastore().get(KeyFactory.createKey("Random", new
>>> Random().nextLong()));
>>> } catch (EntityNotFoundException e) {
>>>       // Ignore
>>> }
>>> Deferred implementation that we use doesn't have access to request headers
>>> (but on Monday or Tuesday maybe it will have ;)). There is no reason to use
>>> costly random class when task name is unique.
>>> Now question is how to set their internal transaction entity group so that I
>>> don't need to use one get datastore operation with throwing exception?
>>>
>>> Tnx, MATijA.
>>>
>>> --
>>> 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.

Reply via email to