public interface CassandraBatchOperations
CassandraBatchOperations use logged Cassandra
BATCHes for single entities and collections of entities. A CassandraBatchOperations instance cannot
be modified/used once it was executed.
Batches are atomic by default. In the context of a Cassandra batch operation, atomic means that if any of the batch
succeeds, all of it will. Statement order does not matter within a batch. CassandraBatchOperations applies
all rows using the same timestamp if supplied, otherwise Cassandra will generate a
timestamp.
Multi partition batches should only be used to achieve atomicity for a few writes on different tables. Apart from this they should be avoided because they’re too expensive. Single partition batches can be used to get atomicity and isolation, they're not much more expensive than normal writes.
| Modifier and Type | Method and Description |
|---|---|
CassandraBatchOperations |
delete(Iterable<?> entities)
Add a collection of deletes to the batch.
|
CassandraBatchOperations |
delete(Iterable<?> entities,
WriteOptions options)
Add a collection of deletes with given
WriteOptions to the batch. |
CassandraBatchOperations |
delete(Object... entities)
Add an array of deletes to the batch.
|
WriteResult |
execute()
Execute the batch.
|
CassandraBatchOperations |
insert(Iterable<?> entities)
Add a collection of inserts to the batch.
|
CassandraBatchOperations |
insert(Iterable<?> entities,
WriteOptions options)
Add a collection of inserts with given
WriteOptions to the batch. |
CassandraBatchOperations |
insert(Object... entities)
Add an array of inserts to the batch.
|
CassandraBatchOperations |
update(Iterable<?> entities)
Add a collection of updates to the batch.
|
CassandraBatchOperations |
update(Iterable<?> entities,
WriteOptions options)
Add a collection of updates with given
WriteOptions to the batch. |
CassandraBatchOperations |
update(Object... entities)
Add an array of updates to the batch.
|
CassandraBatchOperations |
withTimestamp(long timestamp)
Apply a given
timestamp to the whole batch. |
WriteResult execute()
WriteResult for the bulk operation.IllegalStateException - if the batch is executed after it was executed already.CassandraBatchOperations withTimestamp(long timestamp)
timestamp to the whole batch.timestamp - the timestamp to apply.this CassandraBatchOperations.IllegalStateException - if the batch was already executed.CassandraBatchOperations insert(Object... entities)
entities - the entities to insert; must not be null.this CassandraBatchOperations.IllegalStateException - if the batch was already executed.CassandraBatchOperations insert(Iterable<?> entities)
entities - the entities to insert; must not be null.this CassandraBatchOperations.IllegalStateException - if the batch was already executed.CassandraBatchOperations insert(Iterable<?> entities, WriteOptions options)
WriteOptions to the batch.entities - the entities to insert; must not be null.options - the WriteOptions to apply; must not be null.this CassandraBatchOperations.IllegalStateException - if the batch was already executed.InsertOptionsCassandraBatchOperations update(Object... entities)
entities - the entities to update; must not be null.this CassandraBatchOperations.IllegalStateException - if the batch was already executed.CassandraBatchOperations update(Iterable<?> entities)
entities - the entities to update; must not be null.this CassandraBatchOperations.IllegalStateException - if the batch was already executed.CassandraBatchOperations update(Iterable<?> entities, WriteOptions options)
WriteOptions to the batch.entities - the entities to update; must not be null.options - the WriteOptions to apply; must not be null.this CassandraBatchOperations.IllegalStateException - if the batch was already executed.UpdateOptionsCassandraBatchOperations delete(Object... entities)
entities - the entities to delete; must not be null.this CassandraBatchOperations.IllegalStateException - if the batch was already executed.CassandraBatchOperations delete(Iterable<?> entities)
entities - the entities to delete; must not be null.this CassandraBatchOperations.IllegalStateException - if the batch was already executed.CassandraBatchOperations delete(Iterable<?> entities, WriteOptions options)
WriteOptions to the batch.entities - the entities to delete; must not be null.options - the WriteOptions to apply; must not be null.this CassandraBatchOperations.IllegalStateException - if the batch was already executed.DeleteOptionsCopyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.