I like Jeff's solution as it's failsafe, but one more pattern I often
use is to set a couple of flags, and
complete the 2nd action in a finally clause if needed.  The timeout
for the 30 sec limit does allow for a very quick
transaction to still succeed, so I use that time to persist any state
needed for the service I'm running, for example.

On May 14, 4:09 pm, Jeff Schnitzer <j...@infohazard.org> wrote:
> Depending on your application, you may be able to perform the 2nd
> entity write in a task.  Enqueue the task transactionally with the
> first operation.  You'll be guaranteed that if the first entity
> commits, the 2nd will *eventually* be written as well.
>
> It's not a perfect solution for all apps but it does cover a lot of
> practical use cases.
>
> Jeff
>
>
>
> On Sat, May 14, 2011 at 7:52 AM, mscwd01 <mscw...@gmail.com> wrote:
> > Hey
>
> > I have two entities I update and which to persist. These are in two
> > different entity groups so I cannot update and persist them within a
> > Transaction. I am using JDO pm.makePersistentAll and must ensure each
> > entity only saves to the datastore if both can be written.
>
> > What's the best way to do this?
>
> > Thanks
>
> > --
> > 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 google-appengine-java@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > google-appengine-java+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to