Hi Vince. If the put completes, without throwing an exception, all entities
are guaranteed to be persisted to the datastore. But if you don't use
transactions and the put call fails, some entities may be written. Using
transactions allows you to rollback in case the call fails.

- Jason

On Fri, Aug 21, 2009 at 11:43 AM, Vince Bonfanti <vbonfa...@gmail.com>wrote:

>
> I think I've seen this question somewhere else, but I've searched and
> can't seem to find it, so I apologize in advance is this is a
> duplicate.
>
> I'm using the datastore low-level API to do a batch put via
> DatastoreService.put(Iterable<Entity>). Some questions related to this
> method:
>
>  1. If this method succeeds (does not throw an exception) does that
> guarantee that all entities were written to the datastore
> successfully?
>
>  2. If this method fails (throws a DatastoreFailureException) does
> that mean that none of the entities were written, or that some were
> and some weren't? If the latter, is there any way to know which
> entities were successfully written and which weren't?
>
>  3. If I invoke DatastoreService.put(Transaction, Iterable<Entity>)
> and it throws a DatastoreFailureException, does invoking
> Transaction.rollback() guarantee that none of the entities are written
> to the datastore? (I'm pretty sure the answer to this one must be
> "yes").
>
> When doing a batch put, I need to be able to guarantee that all
> entities are either written, or all not written. I think the best way
> is to use a transaction, but thought I'd ask to make sure my
> understanding of how this works is correct. 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 at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to