public interface CassandraBatchOperations
CassandraBatchOperations
use logged Cassandra
BATCH
es 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(Object... entities)
Add an array of deletes to the batch.
|
void |
execute()
Execute the batch.
|
CassandraBatchOperations |
insert(Iterable<?> entities)
Add a collection of inserts 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(Object... entities)
Add an array of updates to the batch.
|
CassandraBatchOperations |
withTimestamp(long timestamp)
Apply a given
timestamp to the whole batch. |
void execute()
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 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 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.Copyright © 2011-2015–2017 Pivotal Software, Inc.. All rights reserved.