public interface Batch
submit().
A usage example:
Entity entity1 = datastore.get(key1);
Batch batch = datastore.newBatch();
Entity entity2 = Entity.builder(key2).set("name", "John").build();
entity1 = Entity.builder(entity1).clear().setNull("bla").build();
Entity entity3 = Entity.builder(key3).set("title", "title").build();
batch.update(entity1);
batch.add(entity2, entity3);
batch.submit();
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Batch.Response |
| Modifier and Type | Method and Description |
|---|---|
boolean |
active()
Returns
true if still active (write operations were not sent to the Datastore). |
List<Entity> |
add(FullEntity<?>... entity)
Datastore add operation.
|
void |
addWithDeferredIdAllocation(FullEntity<?>... entity)
Datastore add operation.
|
Datastore |
datastore()
Returns the batch associated
Datastore. |
void |
delete(Key... key)
A datastore delete operation.
|
void |
put(Entity... entity)
A Datastore put (a.k.a upsert) operation.
|
Batch.Response |
submit()
Submit the batch to the Datastore.
|
void |
update(Entity... entity)
A Datastore update operation.
|
addBatch.Response submit()
DatastoreException - if there was any failure or if batch is not longer activevoid addWithDeferredIdAllocation(FullEntity<?>... entity)
DatastoreWriter.add(FullEntity), this method will defer any necessary id allocation
to submit time.IllegalArgumentException - if any of the given entities is missing a keyDatastoreException - if a given entity with a
complete key was already added to this writer or if not activeList<Entity> add(FullEntity<?>... entity)
put(com.google.cloud.datastore.Entity...).add in interface DatastoreWriterEntity ordered by input with the same properties and a key that
is either newly allocated or the same one if was already completeDatastoreException - if a given entity with the
same complete key was already added to this writer, if writer is not active or
if id allocation for an entity with an incomplete key failed.DatastoreWriter.add(FullEntity)void update(Entity... entity)
put(com.google.cloud.datastore.Entity...) operation for entities that were already
added or put in this writerupdate in interface DatastoreWriterDatastoreException - if an entity is marked for
deletion in this writer or if not activevoid delete(Key... key)
delete in interface DatastoreWriterDatastoreException - if not activevoid put(Entity... entity)
put in interface DatastoreWriterDatastoreException - if not activeboolean active()
true if still active (write operations were not sent to the Datastore).Copyright © 2016 Google. All rights reserved.