public class CassandraTemplate extends CqlTemplate implements CassandraOperations
CqlTemplate
.CqlTemplate
,
CassandraOperations
Modifier and Type | Class and Description |
---|---|
protected static interface |
CassandraTemplate.ClauseCallback |
Modifier and Type | Field and Description |
---|---|
protected CassandraConverter |
cassandraConverter |
protected CassandraMappingContext |
mappingContext |
RESULT_SET_RETURNING_EXTRACTOR, RUN_RUNNABLE_EXECUTOR
logger
Constructor and Description |
---|
CassandraTemplate()
Default constructor used to wire in the required components later.
|
CassandraTemplate(com.datastax.driver.core.Session session)
Creates a new
CassandraTemplate for the given Session . |
CassandraTemplate(com.datastax.driver.core.Session session,
CassandraConverter converter)
|
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Ensures the Cassandra
Session and exception translator has been propertly set. |
protected void |
appendIdCriteria(CassandraTemplate.ClauseCallback clauseCallback,
CassandraPersistentEntity<?> entity,
Map<?,?> id)
Deprecated.
|
protected void |
appendIdCriteria(CassandraTemplate.ClauseCallback clauseCallback,
CassandraPersistentEntity<?> entity,
Object id)
Deprecated.
|
protected void |
appendIdCriteria(com.datastax.driver.core.querybuilder.Delete.Where where,
CassandraPersistentEntity<?> entity,
Object id)
Deprecated.
|
protected void |
appendIdCriteria(com.datastax.driver.core.querybuilder.Select.Where where,
CassandraPersistentEntity<?> entity,
Object id)
Deprecated.
|
CassandraBatchOperations |
batchOps()
Returns a new
CassandraBatchOperations . |
long |
count(Class<?> type)
Returns the number of rows for the given
entityClass by querying the table of the given entity class. |
static <T> com.datastax.driver.core.querybuilder.Batch |
createDeleteBatchQuery(String tableName,
List<T> objectsToDelete,
QueryOptions options,
EntityWriter<Object,Object> entityWriter)
Create a Batch Query object for multiple deletes.
|
static com.datastax.driver.core.querybuilder.Delete |
createDeleteQuery(String tableName,
Object objectToDelete,
QueryOptions options,
EntityWriter<Object,Object> entityWriter)
Create a Delete Query Object from an annotated POJO.
|
static <T> com.datastax.driver.core.querybuilder.Batch |
createInsertBatchQuery(String tableName,
List<T> objectsToInsert,
WriteOptions options,
EntityWriter<Object,Object> entityWriter)
Generates a Batch Object for multiple inserts.
|
static com.datastax.driver.core.querybuilder.Insert |
createInsertQuery(String tableName,
Object objectToUpdate,
WriteOptions options,
EntityWriter<Object,Object> entityWriter)
Generates a Query Object for an insert.
|
static <T> com.datastax.driver.core.querybuilder.Batch |
createUpdateBatchQuery(String tableName,
List<T> objectsToUpdate,
WriteOptions options,
EntityWriter<Object,Object> entityWriter)
Generates a Batch Object for multiple Updates.
|
static com.datastax.driver.core.querybuilder.Update |
createUpdateQuery(String tableName,
Object objectToUpdate,
WriteOptions options,
EntityWriter<Object,Object> entityWriter)
Generates a Query Object for an Update.
|
<T> void |
delete(List<T> entities)
Remove the given objects from the table by id.
|
<T> void |
delete(List<T> entities,
QueryOptions options)
Remove the given objects from the table by id.
|
<T> void |
delete(T entity)
Remove the given object from the table by id.
|
<T> void |
delete(T entity,
QueryOptions options)
Remove the given object from the table by id.
|
<T> void |
deleteAll(Class<T> entityClass)
Deletes all entities of a given class.
|
<T> Cancellable |
deleteAsynchronously(List<T> entities)
Remove the given objects from the table by id.
|
<T> Cancellable |
deleteAsynchronously(List<T> entities,
DeletionListener<T> listener)
Remove the given objects from the table by id.
|
<T> Cancellable |
deleteAsynchronously(List<T> entities,
DeletionListener<T> listener,
QueryOptions options)
Remove the given objects from the table by id.
|
<T> Cancellable |
deleteAsynchronously(List<T> entities,
QueryOptions options)
Remove the given objects from the table by id.
|
<T> Cancellable |
deleteAsynchronously(T entity)
Remove the given object from the table by id.
|
<T> Cancellable |
deleteAsynchronously(T entity,
DeletionListener<T> listener)
Remove the given object from the table by id.
|
<T> Cancellable |
deleteAsynchronously(T entity,
DeletionListener<T> listener,
QueryOptions options)
Remove the given object from the table by id.
|
<T> Cancellable |
deleteAsynchronously(T entity,
QueryOptions options)
Remove the given object from the table by id.
|
void |
deleteById(Class<?> entityClass,
Object id)
Remove the given object from the table by id.
|
protected <T> void |
doBatchDelete(List<T> entities,
QueryOptions options) |
protected <T> Cancellable |
doBatchDeleteAsync(List<T> entities,
DeletionListener<T> listener,
QueryOptions options) |
protected <T> List<T> |
doBatchInsert(List<T> entities,
WriteOptions options) |
protected <T> Cancellable |
doBatchInsertAsync(List<T> entities,
WriteListener<T> listener,
WriteOptions options)
Asynchronously performs a batch insert or update.
|
protected <T> List<T> |
doBatchUpdate(List<T> entities,
WriteOptions options) |
protected <T> Cancellable |
doBatchUpdateAsync(List<T> entities,
WriteListener<T> listener,
WriteOptions options)
Asynchronously performs a batch insert or update.
|
protected <T> List<T> |
doBatchWrite(List<T> entities,
WriteOptions options,
boolean insert) |
protected <T> Cancellable |
doBatchWriteAsync(List<T> entities,
WriteListener<T> listener,
WriteOptions options,
boolean insert)
Asynchronously performs a batch insert or update.
|
protected <T> void |
doDelete(T entity,
QueryOptions options) |
protected <T> Cancellable |
doDeleteAsync(T entity,
DeletionListener<T> listener,
QueryOptions options) |
protected <T> T |
doInsert(T entity,
WriteOptions options) |
protected <T> Cancellable |
doInsertAsync(T entity,
WriteListener<T> listener,
WriteOptions options) |
protected <T> Cancellable |
doInsertAsynchronously(List<T> entities,
WriteListener<T> listener,
WriteOptions options)
This method resolves ambiguity the compiler sees as a result of type erasure between
insertAsynchronously(Object, WriteListener, WriteOptions)
and insertAsynchronously(List, WriteListener, WriteOptions) . |
protected <T> Cancellable |
doSelectOneAsync(Object query,
Class<T> entityClass,
QueryForObjectListener<T> listener,
QueryOptions options) |
protected <T> T |
doUpdate(T entity,
WriteOptions options) |
protected <T> Cancellable |
doUpdateAsync(T entity,
WriteListener<T> listener,
WriteOptions options) |
protected <T> Cancellable |
doUpdateAsynchronously(List<T> entities,
WriteListener<T> listener,
WriteOptions options)
This method resolves ambiguity the compiler sees as a result of type erasure between
updateAsynchronously(Object, WriteListener, WriteOptions)
and updateAsynchronously(List, WriteListener, WriteOptions) . |
boolean |
exists(Class<?> entityClass,
Object id)
Determine whether the row
entityClass with the given id exists. |
CassandraMappingContext |
getCassandraMappingContext()
Deprecated.
as of 1.5, see
getMappingContext() . |
CassandraConverter |
getConverter()
Returns the underlying
CassandraConverter . |
CassandraMappingContext |
getMappingContext()
Returns the
CassandraMappingContext . |
CqlIdentifier |
getTableName(Class<?> entityClass)
The table name used for the specified class by this template.
|
<T> List<T> |
insert(List<T> entities)
Insert the given list of entities.
|
<T> List<T> |
insert(List<T> entities,
WriteOptions options)
Insert the given list of entities.
|
<T> T |
insert(T entity)
Insert the given entity without inserting null values.
|
<T> T |
insert(T entity,
WriteOptions options)
Insert the given entity without inserting null values.
|
<T> List<T> |
insertAsynchronously(List<T> entities)
Deprecated.
as of 1.2, see
insertAsynchronously(Object, WriteListener) |
<T> Cancellable |
insertAsynchronously(List<T> entities,
WriteListener<T> listener)
Inserts the given entities asynchronously in a batch.
|
<T> Cancellable |
insertAsynchronously(List<T> entities,
WriteListener<T> listener,
WriteOptions options)
Inserts the given entities asynchronously in a batch.
|
<T> List<T> |
insertAsynchronously(List<T> entities,
WriteOptions options)
Deprecated.
as of 1.2, see
insertAsynchronously(List, WriteListener, WriteOptions) |
<T> T |
insertAsynchronously(T entity)
Deprecated.
as of 1.2, see
insertAsynchronously(List, WriteListener, WriteOptions) . |
<T> Cancellable |
insertAsynchronously(T entity,
WriteListener<T> listener)
Inserts the given entity asynchronously.
|
<T> Cancellable |
insertAsynchronously(T entity,
WriteListener<T> listener,
WriteOptions options)
Inserts the given entity asynchronously.
|
<T> T |
insertAsynchronously(T entity,
WriteOptions options)
Deprecated.
as of 1.2, see
insertAsynchronously(List, WriteListener, WriteOptions) . |
protected <T> List<T> |
select(com.datastax.driver.core.querybuilder.Select query,
CassandraConverterRowCallback<T> rowCallback) |
<T> List<T> |
select(com.datastax.driver.core.querybuilder.Select select,
Class<T> entityClass)
Execute the Select Query and convert to the list of entities.
|
protected <T> List<T> |
select(String query,
CassandraConverterRowCallback<T> rowCallback) |
<T> List<T> |
select(String cql,
Class<T> entityClass)
Execute query and convert ResultSet to the list of entities.
|
<T> List<T> |
selectAll(Class<T> entityClass) |
<T> List<T> |
selectBySimpleIds(Class<T> entityClass,
Iterable<?> ids)
Select objects for the given
entityClass and ids . |
protected <T> T |
selectOne(com.datastax.driver.core.querybuilder.Select query,
CassandraConverterRowCallback<T> rowCallback) |
<T> T |
selectOne(com.datastax.driver.core.querybuilder.Select select,
Class<T> entityClass)
Execute Select query and convert ResultSet to the entity
|
protected <T> T |
selectOne(String query,
CassandraConverterRowCallback<T> rowCallback) |
<T> T |
selectOne(String cql,
Class<T> entityClass)
Execute CQL and convert ResultSet to the entity
|
<T> Cancellable |
selectOneAsynchronously(com.datastax.driver.core.querybuilder.Select select,
Class<T> type,
QueryForObjectListener<T> listener)
Executes the
Select query asynchronously. |
<T> Cancellable |
selectOneAsynchronously(com.datastax.driver.core.querybuilder.Select select,
Class<T> entityClass,
QueryForObjectListener<T> listener,
QueryOptions options)
Executes the
Select query asynchronously. |
<T> Cancellable |
selectOneAsynchronously(String cql,
Class<T> entityClass,
QueryForObjectListener<T> listener)
Executes the string CQL query asynchronously.
|
<T> Cancellable |
selectOneAsynchronously(String cql,
Class<T> entityClass,
QueryForObjectListener<T> listener,
QueryOptions options)
Executes the string CQL query asynchronously.
|
<T> T |
selectOneById(Class<T> entityClass,
Object id)
Execute the Select by
id for the given entityClass . |
void |
setConverter(CassandraConverter cassandraConverter)
Set the
CassandraConverter used by this template to perform conversions. |
<T> Iterator<T> |
stream(String query,
Class<T> entityClass)
Executes the given select
query on the entity table of the specified type backed by a Cassandra
ResultSet . |
static <T> com.datastax.driver.core.querybuilder.Batch |
toUpdateBatchQuery(String tableName,
List<T> objectsToUpdate,
WriteOptions options,
EntityWriter<Object,Object> entityWriter)
Deprecated.
as of 1.2, method renamed. Use
createUpdateBatchQuery(String, List, WriteOptions, EntityWriter) |
static com.datastax.driver.core.querybuilder.Update |
toUpdateQueryX(String tableName,
Object objectToUpdate,
WriteOptions options,
EntityWriter<Object,Object> entityWriter)
Deprecated.
as of 1.2, method renamed. Use
createUpdateQuery(String, Object, WriteOptions, EntityWriter) |
<T> List<T> |
update(List<T> entities)
Update the given list of entities.
|
<T> List<T> |
update(List<T> entities,
WriteOptions options)
Update the given list of entities.
|
<T> T |
update(T entity)
Update the given entity.
|
<T> T |
update(T entity,
WriteOptions options)
Update the given entity.
|
<T> List<T> |
updateAsynchronously(List<T> entities)
Updates the given entities asynchronously in a batch.
|
<T> Cancellable |
updateAsynchronously(List<T> entities,
WriteListener<T> listener)
Updates the given entities asynchronously in a batch.
|
<T> Cancellable |
updateAsynchronously(List<T> entities,
WriteListener<T> listener,
WriteOptions options)
Updates the given entities asynchronously in a batch.
|
<T> List<T> |
updateAsynchronously(List<T> entities,
WriteOptions options)
Updates the given entities asynchronously in a batch.
|
<T> T |
updateAsynchronously(T entity)
Updates the given entity asynchronously.
|
<T> Cancellable |
updateAsynchronously(T entity,
WriteListener<T> listener)
Updates the given entity asynchronously.
|
<T> Cancellable |
updateAsynchronously(T entity,
WriteListener<T> listener,
WriteOptions options)
Updates the given entity asynchronously.
|
<T> T |
updateAsynchronously(T entity,
WriteOptions options)
Updates the given entity asynchronously.
|
addPreparedStatementOptions, addQueryOptions, addWriteOptions, addWriteOptions, count, count, describeRing, describeRing, doExecute, doExecute, doExecute, doExecute, doExecuteAsync, doExecuteAsync, doExecuteAsync, doExecuteQueryReturnResultSet, doExecuteQueryReturnResultSet, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, firstColumnToObject, getHosts, getResultSetUninterruptibly, getResultSetUninterruptibly, getResultSetUninterruptibly, ingest, ingest, ingest, ingest, ingest, ingest, logCql, logCql, logStatement, process, process, processList, processListOfMap, processMap, processOne, processOne, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryForList, queryForList, queryForListAsynchronously, queryForListAsynchronously, queryForListOfMap, queryForListOfMap, queryForListOfMapAsynchronously, queryForListOfMapAsynchronously, queryForListOfMapAsynchronously, queryForMap, queryForMap, queryForMapAsynchronously, queryForMapAsynchronously, queryForMapAsynchronously, queryForObject, queryForObject, queryForObject, queryForObject, queryForObjectAsynchronously, queryForObjectAsynchronously, queryForObjectAsynchronously, queryForObjectAsynchronously, queryForObjectAsynchronously, queryForObjectAsynchronously, selectCount, toMap, translateExceptionIfPossible, translateExceptionIfPossible, truncate, truncate
getExceptionTranslator, getSession, logDebug, setExceptionTranslator, setSession
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
count, count, describeRing, describeRing, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, executeAsynchronously, getResultSetUninterruptibly, getResultSetUninterruptibly, getResultSetUninterruptibly, getSession, ingest, ingest, ingest, ingest, ingest, ingest, process, process, processList, processListOfMap, processMap, processOne, processOne, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryAsynchronously, queryForList, queryForList, queryForListAsynchronously, queryForListAsynchronously, queryForListOfMap, queryForListOfMap, queryForListOfMapAsynchronously, queryForListOfMapAsynchronously, queryForListOfMapAsynchronously, queryForMap, queryForMap, queryForMapAsynchronously, queryForMapAsynchronously, queryForMapAsynchronously, queryForObject, queryForObject, queryForObject, queryForObject, queryForObjectAsynchronously, queryForObjectAsynchronously, queryForObjectAsynchronously, queryForObjectAsynchronously, queryForObjectAsynchronously, queryForObjectAsynchronously, truncate, truncate
protected CassandraConverter cassandraConverter
protected CassandraMappingContext mappingContext
public CassandraTemplate()
public CassandraTemplate(com.datastax.driver.core.Session session)
CassandraTemplate
for the given Session
.session
- Cassandra Session
connected to the Cassandra cluster instance;
must not be null.Session
public CassandraTemplate(com.datastax.driver.core.Session session, CassandraConverter converter)
session
- Session
used to interact with Cassandra; must not be null.converter
- CassandraConverter
used to convert between Java and Cassandra types;
must not be null.CassandraConverter
,
Session
public void setConverter(CassandraConverter cassandraConverter)
CassandraConverter
used by this template to perform conversions.cassandraConverter
- Converter used to perform conversion of Cassandra data types to entity types.
Must not be null.IllegalArgumentException
- if cassandraConverter
is null.public CassandraConverter getConverter()
CassandraOperations
CassandraConverter
.getConverter
in interface CassandraOperations
CassandraConverter
.@Deprecated public CassandraMappingContext getCassandraMappingContext()
getMappingContext()
.public CassandraMappingContext getMappingContext()
CassandraMappingContext
.CassandraMappingContext
.public void afterPropertiesSet()
CassandraAccessor
Session
and exception translator has been propertly set.afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class CassandraAccessor
public boolean exists(Class<?> entityClass, Object id)
CassandraOperations
entityClass
with the given id
exists.exists
in interface CassandraOperations
entityClass
- The entity type must not be null.id
- must not be null.public long count(Class<?> type)
CassandraOperations
entityClass
by querying the table of the given entity class.count
in interface CassandraOperations
type
- The entity type must not be null.public <T> void delete(List<T> entities)
CassandraOperations
delete
in interface CassandraOperations
entities
- must not be null.public <T> void delete(List<T> entities, QueryOptions options)
CassandraOperations
delete
in interface CassandraOperations
entities
- must not be null.options
- may be null.public void deleteById(Class<?> entityClass, Object id)
CassandraOperations
deleteById
in interface CassandraOperations
entityClass
- The entity type must not be null.id
- must not be null.public <T> void delete(T entity)
CassandraOperations
delete
in interface CassandraOperations
entity
- must not be null.public <T> void delete(T entity, QueryOptions options)
CassandraOperations
delete
in interface CassandraOperations
entity
- must not be null.options
- may be null.public <T> Cancellable deleteAsynchronously(List<T> entities)
CassandraOperations
deleteAsynchronously
in interface CassandraOperations
entities
- The objects to deletepublic <T> Cancellable deleteAsynchronously(List<T> entities, QueryOptions options)
CassandraOperations
deleteAsynchronously
in interface CassandraOperations
entities
- The objects to deleteoptions
- The QueryOptions
to usepublic <T> Cancellable deleteAsynchronously(List<T> entities, DeletionListener<T> listener)
CassandraOperations
deleteAsynchronously
in interface CassandraOperations
entities
- The objects to deletelistener
- The DeletionListener
to receive notification upon completionpublic <T> Cancellable deleteAsynchronously(List<T> entities, DeletionListener<T> listener, QueryOptions options)
CassandraOperations
deleteAsynchronously
in interface CassandraOperations
entities
- The objects to deletelistener
- The DeletionListener
to receive notification upon completionoptions
- The QueryOptions
to usepublic <T> Cancellable deleteAsynchronously(T entity)
CassandraOperations
deleteAsynchronously
in interface CassandraOperations
entity
- The object to deletepublic <T> Cancellable deleteAsynchronously(T entity, QueryOptions options)
CassandraOperations
deleteAsynchronously
in interface CassandraOperations
entity
- The object to deleteoptions
- The QueryOptions
to usepublic <T> Cancellable deleteAsynchronously(T entity, DeletionListener<T> listener)
CassandraOperations
deleteAsynchronously
in interface CassandraOperations
entity
- The object to deletelistener
- The DeletionListener
to receive notification upon completionpublic <T> Cancellable deleteAsynchronously(T entity, DeletionListener<T> listener, QueryOptions options)
CassandraOperations
deleteAsynchronously
in interface CassandraOperations
entity
- The object to deletelistener
- The DeletionListener
to receive notification upon completionoptions
- The QueryOptions
to usepublic CqlIdentifier getTableName(Class<?> entityClass)
CassandraOperations
getTableName
in interface CassandraOperations
entityClass
- The entity type must not be null.CqlIdentifier
public <T> List<T> insert(List<T> entities)
CassandraOperations
insert
in interface CassandraOperations
entities
- The entities to insert.public <T> List<T> insert(List<T> entities, WriteOptions options)
CassandraOperations
insert
in interface CassandraOperations
entities
- The entities to insert.options
- The WriteOptions
to use.public <T> T insert(T entity)
CassandraOperations
insert
in interface CassandraOperations
entity
- The entity to insertpublic <T> T insert(T entity, WriteOptions options)
CassandraOperations
insert
in interface CassandraOperations
entity
- The entity to insertoptions
- The WriteOptions
to use.@Deprecated public <T> List<T> insertAsynchronously(List<T> entities)
insertAsynchronously(Object, WriteListener)
CassandraOperations
insertAsynchronously
in interface CassandraOperations
entities
- The entities to insertCassandraOperations.insertAsynchronously(List, WriteListener)
@Deprecated public <T> List<T> insertAsynchronously(List<T> entities, WriteOptions options)
insertAsynchronously(List, WriteListener, WriteOptions)
CassandraOperations
insertAsynchronously
in interface CassandraOperations
entities
- The entities to insertCassandraOperations.insertAsynchronously(List, WriteListener, WriteOptions)
public <T> Cancellable insertAsynchronously(List<T> entities, WriteListener<T> listener)
CassandraOperations
insertAsynchronously
in interface CassandraOperations
entities
- The entities to insertlistener
- The listener to receive notification of completionCancellable
enabling the cancellation of the operationpublic <T> Cancellable insertAsynchronously(List<T> entities, WriteListener<T> listener, WriteOptions options)
CassandraOperations
insertAsynchronously
in interface CassandraOperations
entities
- The entities to insertlistener
- The listener to receive notification of completionoptions
- The WriteOptions
to useCancellable
enabling the cancellation of the operationprotected <T> Cancellable doInsertAsynchronously(List<T> entities, WriteListener<T> listener, WriteOptions options)
insertAsynchronously(Object, WriteListener, WriteOptions)
and insertAsynchronously(List, WriteListener, WriteOptions)
.@Deprecated public <T> T insertAsynchronously(T entity)
insertAsynchronously(List, WriteListener, WriteOptions)
.CassandraOperations
insertAsynchronously
in interface CassandraOperations
entity
- The entity to insertCassandraOperations.insertAsynchronously(Object, WriteListener)
@Deprecated public <T> T insertAsynchronously(T entity, WriteOptions options)
insertAsynchronously(List, WriteListener, WriteOptions)
.CassandraOperations
insertAsynchronously
in interface CassandraOperations
entity
- The entity to insertCassandraOperations.insertAsynchronously(Object, WriteOptions)
public <T> Cancellable insertAsynchronously(T entity, WriteListener<T> listener)
CassandraOperations
insertAsynchronously
in interface CassandraOperations
entity
- The entity to insertlistener
- The listener to receive notification of completionCancellable
enabling the cancellation of the operationpublic <T> Cancellable insertAsynchronously(T entity, WriteListener<T> listener, WriteOptions options)
CassandraOperations
insertAsynchronously
in interface CassandraOperations
entity
- The entity to insertlistener
- The listener to receive notification of completionoptions
- The WriteOptions
to useCancellable
enabling the cancellation of the operationpublic <T> List<T> selectAll(Class<T> entityClass)
selectAll
in interface CassandraOperations
entityClass
- The entity type must not be null.T
.public <T> List<T> select(String cql, Class<T> entityClass)
CassandraOperations
select
in interface CassandraOperations
cql
- must not be null.entityClass
- The entity type must not be null.public <T> List<T> select(com.datastax.driver.core.querybuilder.Select select, Class<T> entityClass)
CassandraOperations
select
in interface CassandraOperations
select
- must not be null.entityClass
- The entity type must not be null.public <T> List<T> selectBySimpleIds(Class<T> entityClass, Iterable<?> ids)
CassandraOperations
entityClass
and ids
.selectBySimpleIds
in interface CassandraOperations
entityClass
- The entity type must not be null.ids
- must not be null.public <T> T selectOneById(Class<T> entityClass, Object id)
CassandraOperations
id
for the given entityClass
.selectOneById
in interface CassandraOperations
entityClass
- The entity type must not be null.id
- must not be null.@Deprecated protected void appendIdCriteria(CassandraTemplate.ClauseCallback clauseCallback, CassandraPersistentEntity<?> entity, Map<?,?> id)
@Deprecated protected void appendIdCriteria(CassandraTemplate.ClauseCallback clauseCallback, CassandraPersistentEntity<?> entity, Object id)
@Deprecated protected void appendIdCriteria(com.datastax.driver.core.querybuilder.Select.Where where, CassandraPersistentEntity<?> entity, Object id)
@Deprecated protected void appendIdCriteria(com.datastax.driver.core.querybuilder.Delete.Where where, CassandraPersistentEntity<?> entity, Object id)
public <T> T selectOne(String cql, Class<T> entityClass)
CassandraOperations
selectOne
in interface CassandraOperations
cql
- must not be null.entityClass
- The entity type must not be null.public <T> T selectOne(com.datastax.driver.core.querybuilder.Select select, Class<T> entityClass)
CassandraOperations
selectOne
in interface CassandraOperations
select
- must not be null.entityClass
- The entity type must not be null.public <T> List<T> update(List<T> entities)
CassandraOperations
update
in interface CassandraOperations
entities
- The entities to update.public <T> List<T> update(List<T> entities, WriteOptions options)
CassandraOperations
update
in interface CassandraOperations
entities
- The entities to update.options
- The WriteOptions
to use.public <T> T update(T entity)
CassandraOperations
update
in interface CassandraOperations
entity
- The entity to updatepublic <T> T update(T entity, WriteOptions options)
CassandraOperations
update
in interface CassandraOperations
entity
- The entity to updateoptions
- The WriteOptions
to use.public <T> List<T> updateAsynchronously(List<T> entities)
CassandraOperations
updateAsynchronously
in interface CassandraOperations
entities
- The entities to updateCassandraOperations.updateAsynchronously(List, WriteListener)
public <T> List<T> updateAsynchronously(List<T> entities, WriteOptions options)
CassandraOperations
updateAsynchronously
in interface CassandraOperations
entities
- The entities to updateCassandraOperations.updateAsynchronously(List, WriteListener, WriteOptions)
public <T> Cancellable updateAsynchronously(List<T> entities, WriteListener<T> listener)
CassandraOperations
updateAsynchronously
in interface CassandraOperations
entities
- The entities to updatelistener
- The listener to receive notification of completionCancellable
enabling the cancellation of the operationpublic <T> Cancellable updateAsynchronously(List<T> entities, WriteListener<T> listener, WriteOptions options)
CassandraOperations
updateAsynchronously
in interface CassandraOperations
entities
- The entities to updatelistener
- The listener to receive notification of completionoptions
- The WriteOptions
to useCancellable
enabling the cancellation of the operationprotected <T> Cancellable doUpdateAsynchronously(List<T> entities, WriteListener<T> listener, WriteOptions options)
updateAsynchronously(Object, WriteListener, WriteOptions)
and updateAsynchronously(List, WriteListener, WriteOptions)
.public <T> T updateAsynchronously(T entity)
CassandraOperations
updateAsynchronously
in interface CassandraOperations
entity
- The entity to updateCassandraOperations.updateAsynchronously(Object, WriteListener)
public <T> T updateAsynchronously(T entity, WriteOptions options)
CassandraOperations
updateAsynchronously
in interface CassandraOperations
entity
- The entity to updateCassandraOperations.updateAsynchronously(Object, WriteOptions)
public <T> Cancellable updateAsynchronously(T entity, WriteListener<T> listener)
CassandraOperations
updateAsynchronously
in interface CassandraOperations
entity
- The entity to updatelistener
- The listener to receive notification of completionCancellable
enabling the cancellation of the operationpublic <T> Cancellable updateAsynchronously(T entity, WriteListener<T> listener, WriteOptions options)
CassandraOperations
updateAsynchronously
in interface CassandraOperations
entity
- The entity to updatelistener
- The listener to receive notification of completionoptions
- The WriteOptions
to useCancellable
enabling the cancellation of the operationprotected <T> List<T> select(String query, CassandraConverterRowCallback<T> rowCallback)
protected <T> List<T> select(com.datastax.driver.core.querybuilder.Select query, CassandraConverterRowCallback<T> rowCallback)
public <T> Iterator<T> stream(String query, Class<T> entityClass)
CassandraOperations
query
on the entity table of the specified type
backed by a Cassandra
ResultSet
.
Returns a Iterator
that wraps the Cassandra ResultSet
.
stream
in interface CassandraOperations
T
- element return type.query
- query to execute. Must not be empty or null.entityClass
- Class type of the elements in the Iterator
stream. Must not be null.Iterator
(stream) over the elements in the query result set.protected <T> T selectOne(String query, CassandraConverterRowCallback<T> rowCallback)
protected <T> T selectOne(com.datastax.driver.core.querybuilder.Select query, CassandraConverterRowCallback<T> rowCallback)
protected <T> void doBatchDelete(List<T> entities, QueryOptions options)
protected <T> Cancellable doBatchDeleteAsync(List<T> entities, DeletionListener<T> listener, QueryOptions options)
protected <T> T doInsert(T entity, WriteOptions options)
protected <T> Cancellable doInsertAsync(T entity, WriteListener<T> listener, WriteOptions options)
protected <T> List<T> doBatchInsert(List<T> entities, WriteOptions options)
protected <T> List<T> doBatchUpdate(List<T> entities, WriteOptions options)
protected <T> List<T> doBatchWrite(List<T> entities, WriteOptions options, boolean insert)
protected <T> Cancellable doBatchInsertAsync(List<T> entities, WriteListener<T> listener, WriteOptions options)
entities
- The entities to insert or update.listener
- The listener that will receive notification of the completion of the batch insert or update. May be
null
.options
- The WriteOptions
to use. May be null
.Cancellable
that can be used to cancel the query if necessary.protected <T> Cancellable doBatchUpdateAsync(List<T> entities, WriteListener<T> listener, WriteOptions options)
entities
- The entities to insert or update.listener
- The listener that will receive notification of the completion of the batch insert or update. May be
null
.options
- The WriteOptions
to use. May be null
.Cancellable
that can be used to cancel the query if necessary.protected <T> Cancellable doBatchWriteAsync(List<T> entities, WriteListener<T> listener, WriteOptions options, boolean insert)
entities
- The entities to insert or update.listener
- The listener that will receive notification of the completion of the batch insert or update. May be
null
.options
- The WriteOptions
to use. May be null
.insert
- If true
, then an insert is performed, else an update is performed.Cancellable
that can be used to cancel the query if necessary.protected <T> void doDelete(T entity, QueryOptions options)
protected <T> Cancellable doDeleteAsync(T entity, DeletionListener<T> listener, QueryOptions options)
protected <T> T doUpdate(T entity, WriteOptions options)
protected <T> Cancellable doUpdateAsync(T entity, WriteListener<T> listener, WriteOptions options)
public CassandraBatchOperations batchOps()
CassandraOperations
CassandraBatchOperations
. Each CassandraBatchOperations
instance can be executed only
once so you might want to obtain new CassandraBatchOperations
instances for each batch.batchOps
in interface CassandraOperations
CassandraBatchOperations
associated with the given entity class.public static com.datastax.driver.core.querybuilder.Insert createInsertQuery(String tableName, Object objectToUpdate, WriteOptions options, EntityWriter<Object,Object> entityWriter)
tableName
- the table name, must not be empty and not null.objectToUpdate
- the object to save, must not be null.options
- optional WriteOptions
to apply to the Insert
statement, may be null.entityWriter
- the EntityWriter
to write insert values.public static <T> com.datastax.driver.core.querybuilder.Batch createInsertBatchQuery(String tableName, List<T> objectsToInsert, WriteOptions options, EntityWriter<Object,Object> entityWriter)
tableName
- the table name, must not be empty and not null.objectsToInsert
- the object to save, must not be empty and not null.options
- optional WriteOptions
to apply to the Insert
statement, may be null.entityWriter
- the EntityWriter
to write insert values.public static com.datastax.driver.core.querybuilder.Update createUpdateQuery(String tableName, Object objectToUpdate, WriteOptions options, EntityWriter<Object,Object> entityWriter)
Update
uses the identity and values from the given
objectsToUpdate
.tableName
- the table name, must not be empty and not null.objectToUpdate
- the object to update, must not be null.options
- optional WriteOptions
to apply to the Update
statement, may be null.entityWriter
- the EntityWriter
to write update assignments and where clauses.public static <T> com.datastax.driver.core.querybuilder.Batch createUpdateBatchQuery(String tableName, List<T> objectsToUpdate, WriteOptions options, EntityWriter<Object,Object> entityWriter)
Update
uses the identity and values from the given
objectsToUpdate
.tableName
- the table name, must not be empty and not null.objectsToUpdate
- the object to update, must not be empty and not null.options
- optional WriteOptions
to apply to the Update
statement, may be null.entityWriter
- the EntityWriter
to write update assignments and where clauses.@Deprecated public static <T> com.datastax.driver.core.querybuilder.Batch toUpdateBatchQuery(String tableName, List<T> objectsToUpdate, WriteOptions options, EntityWriter<Object,Object> entityWriter)
createUpdateBatchQuery(String, List, WriteOptions, EntityWriter)
@Deprecated public static com.datastax.driver.core.querybuilder.Update toUpdateQueryX(String tableName, Object objectToUpdate, WriteOptions options, EntityWriter<Object,Object> entityWriter)
createUpdateQuery(String, Object, WriteOptions, EntityWriter)
public static com.datastax.driver.core.querybuilder.Delete createDeleteQuery(String tableName, Object objectToDelete, QueryOptions options, EntityWriter<Object,Object> entityWriter)
Delete
uses the identity from the given
objectToDelete
.tableName
- the table name, must not be empty and not null.objectToDelete
- the object to delete, must not be null.options
- optional QueryOptions
to apply to the Delete
statement, may be null.entityWriter
- the EntityWriter
to write delete where clauses.public static <T> com.datastax.driver.core.querybuilder.Batch createDeleteBatchQuery(String tableName, List<T> objectsToDelete, QueryOptions options, EntityWriter<Object,Object> entityWriter)
tableName
- the table name, must not be empty and not null.objectsToDelete
- the object to delete, must not be empty and not null.options
- optional QueryOptions
to apply to the Delete
statement, may be null.entityWriter
- the EntityWriter
to write delete where clauses.public <T> void deleteAll(Class<T> entityClass)
CassandraOperations
deleteAll
in interface CassandraOperations
entityClass
- The entity type must not be null.public <T> Cancellable selectOneAsynchronously(com.datastax.driver.core.querybuilder.Select select, Class<T> type, QueryForObjectListener<T> listener)
CassandraOperations
Select
query asynchronously.selectOneAsynchronously
in interface CassandraOperations
select
- The Select
query to execute.type
- The entity type must not be null.Cancellable
that can be used to cancel the query.public <T> Cancellable selectOneAsynchronously(String cql, Class<T> entityClass, QueryForObjectListener<T> listener)
CassandraOperations
selectOneAsynchronously
in interface CassandraOperations
cql
- The string query CQL to execute.entityClass
- The entity type must not be null.Cancellable
that can be used to cancel the query.public <T> Cancellable selectOneAsynchronously(com.datastax.driver.core.querybuilder.Select select, Class<T> entityClass, QueryForObjectListener<T> listener, QueryOptions options)
CassandraOperations
Select
query asynchronously.selectOneAsynchronously
in interface CassandraOperations
select
- The Select
query to execute.entityClass
- The entity type must not be null.options
- The QueryOptions
to use.Cancellable
that can be used to cancel the query.public <T> Cancellable selectOneAsynchronously(String cql, Class<T> entityClass, QueryForObjectListener<T> listener, QueryOptions options)
CassandraOperations
selectOneAsynchronously
in interface CassandraOperations
cql
- The string query CQL to execute.entityClass
- The entity type must not be null.options
- The QueryOptions
to use.Cancellable
that can be used to cancel the query.protected <T> Cancellable doSelectOneAsync(Object query, Class<T> entityClass, QueryForObjectListener<T> listener, QueryOptions options)
Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.