public interface Batch
submit().
A usage example:
Entity entity1 = datastore.get(key1);
Batch batch = datastore.newBatch();
Entity entity2 = Entity.newBuilder(key2).set("name", "John").build();
entity1 = Entity.newBuilder(entity1).clear().setNull("bla").build();
Entity entity3 = Entity.newBuilder(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()
Deprecated.
|
List<Entity> |
add(FullEntity<?>... entities)
Datastore add operation.
|
void |
addWithDeferredIdAllocation(FullEntity<?>... entities)
Datastore add operation.
|
Datastore |
datastore()
Deprecated.
|
void |
delete(Key... keys)
A datastore delete operation.
|
Datastore |
getDatastore()
Returns the batch associated
Datastore. |
boolean |
isActive()
Returns
true if still active (write operations were not sent to the Datastore). |
List<Entity> |
put(FullEntity<?>... entities)
A Datastore put (a.k.a upsert) operation.
|
void |
putWithDeferredIdAllocation(FullEntity<?>... entities)
Datastore put operation.
|
Batch.Response |
submit()
Submit the batch to the Datastore.
|
void |
update(Entity... entities)
A Datastore update operation.
|
add, putBatch.Response submit()
DatastoreException - if there was any failure or if batch is not longer active@Deprecated Datastore datastore()
Datastore.void addWithDeferredIdAllocation(FullEntity<?>... entities)
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<?>... entities)
put(com.google.cloud.datastore.FullEntity<?>...).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... entities)
put(com.google.cloud.datastore.FullEntity<?>...) operation for entities that were already
added or put in this writer.update in interface DatastoreWriterDatastoreException - if an entity is marked for deletion in this writer or if not activevoid delete(Key... keys)
delete in interface DatastoreWriterDatastoreException - if not activevoid putWithDeferredIdAllocation(FullEntity<?>... entities)
put(FullEntity[]), this method will defer any necessary id
allocation to submit time.IllegalArgumentException - if any of the given entities is missing a keyDatastoreException - if not activeList<Entity> put(FullEntity<?>... entities)
put in interface DatastoreWriterEntity, ordered by input. Returned keys are
either newly allocated or the same one if was already complete.DatastoreException - if not active@Deprecated boolean active()
true if still active (write operations were not sent to the Datastore).boolean isActive()
true if still active (write operations were not sent to the Datastore).Copyright © 2016 Google. All rights reserved.