Class AsyncCassandraTemplate
- All Implemented Interfaces:
Aware,ApplicationContextAware,ApplicationEventPublisherAware,AsyncCassandraOperations
AsyncCassandraOperations. It simplifies the use of asynchronous Cassandra usage and
helps to avoid common errors. It executes core Cassandra workflow. This class executes CQL queries or updates,
initiating iteration over ResultSet and catching Cassandra exceptions and translating them to the generic,
more informative exception hierarchy defined in the org.springframework.dao package.
Can be used within a service implementation via direct instantiation with a CqlSession reference, or get
prepared in an application context and given to services as bean reference.
This class supports the use of prepared statements when enabling setUsePreparedStatements(boolean). All
statements created by methods of this class (such as select(Query, Class) or
update(Query, org.springframework.data.cassandra.core.query.Update, Class) will be executed as prepared
statements. Also, statements accepted by methods (such as select(String, Class) or
and others) will be prepared prior to execution. Note that Statement
objects passed to methods must be SimpleStatement so that these can be prepared.
Note: The CqlSession should always be configured as a bean in the application context, in the first case
given to the service directly, in the second case to the prepared template.
- Since:
- 4.0
- Author:
- Mark Paluch, John Blum
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDeprecated, for removal: This API element is subject to removal in a future version.General callback interface used to create and bind prepared CQL statements.static classDeprecated, for removal: This API element is subject to removal in a future version.Utility class to prepare aSimpleStatementand bind values associated with the statement to aBoundStatement. -
Constructor Summary
ConstructorsConstructorDescriptionAsyncCassandraTemplate(com.datastax.oss.driver.api.core.CqlSession session) Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance ofAsyncCassandraTemplateinitialized with the givenCqlSessionand a defaultMappingCassandraConverter.AsyncCassandraTemplate(com.datastax.oss.driver.api.core.CqlSession session, CassandraConverter converter) Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance ofAsyncCassandraTemplateinitialized with the givenCqlSessionandCassandraConverter.AsyncCassandraTemplate(AsyncCqlTemplate asyncCqlTemplate, CassandraConverter converter) Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance ofAsyncCassandraTemplateinitialized with the givenAsyncCqlTemplateandCassandraConverter.AsyncCassandraTemplate(SessionFactory sessionFactory, CassandraConverter converter) Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance ofAsyncCassandraTemplateinitialized with the givenSessionFactoryandCassandraConverter. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Returns the number of rows for the given entity class.Deprecated, for removal: This API element is subject to removal in a future version.Returns the number of rows for the given entity class applyingQuery.createPreparedStatementHandler(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Deprecated, for removal: This API element is subject to removal in a future version.Create a new statement-basedAsyncCassandraTemplate.AsyncPreparedStatementHandlerusing the statement passed in.delete(Object entity, QueryOptions options) Deprecated, for removal: This API element is subject to removal in a future version.Delete the given entity applyingQueryOptionsand return the entity if the delete statement was applied.Deprecated, for removal: This API element is subject to removal in a future version.Remove entities (rows)/columns from the table byQuery.<T> ListenableFuture<T>delete(T entity) Deprecated, for removal: This API element is subject to removal in a future version.Delete the given entity and return the entity if the delete statement was applied.deleteById(Object id, Class<?> entityClass) Deprecated, for removal: This API element is subject to removal in a future version.Remove the given object from the table by id.ListenableFuture<com.datastax.oss.driver.api.core.cql.AsyncResultSet>execute(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Deprecated, for removal: This API element is subject to removal in a future version.Execute the given CassandraStatement.Deprecated, for removal: This API element is subject to removal in a future version.Determine whether a row ofentityClasswith the givenidexists.Deprecated, for removal: This API element is subject to removal in a future version.Determine whether the result forentityClassQueryyields at least one row.Deprecated, for removal: This API element is subject to removal in a future version.Expose the underlyingAsyncCqlOperationsto allow asynchronous CQL operations.Deprecated, for removal: This API element is subject to removal in a future version.Returns the underlyingCassandraConverter.protected org.springframework.data.cassandra.core.legacy.EntityOperationsDeprecated, for removal: This API element is subject to removal in a future version.Returns theEntityOperationsused to perform data access operations on an entity inside a Cassandra data source.protected SpelAwareProxyProjectionFactoryDeprecated.since 3.4, useCassandraConverter.getProjectionFactory()instead.protected StatementFactoryDeprecated, for removal: This API element is subject to removal in a future version.Returns theStatementFactoryused by this template to construct and run Cassandra CQL statements.<T> ListenableFuture<T>insert(T entity) Deprecated, for removal: This API element is subject to removal in a future version.Insert the given entity and return the entity if the insert was applied.<T> ListenableFuture<EntityWriteResult<T>>insert(T entity, InsertOptions options) Deprecated, for removal: This API element is subject to removal in a future version.Insert the given entity applyingWriteOptionsand return the entity if the insert was applied.booleanDeprecated, for removal: This API element is subject to removal in a future version.Returns whether this instance is configured to useprepared statements.protected <T> TmaybeCallBeforeConvert(T object, com.datastax.oss.driver.api.core.CqlIdentifier tableName) Deprecated, for removal: This API element is subject to removal in a future version.protected <T> TmaybeCallBeforeSave(T object, com.datastax.oss.driver.api.core.CqlIdentifier tableName, com.datastax.oss.driver.api.core.cql.Statement<?> statement) Deprecated, for removal: This API element is subject to removal in a future version.protected <E extends CassandraMappingEvent<T>,T>
voidmaybeEmitEvent(Supplier<E> event) Deprecated, for removal: This API element is subject to removal in a future version.<T> ListenableFuture<List<T>>Deprecated, for removal: This API element is subject to removal in a future version.Execute aSELECTquery and convert the resulting items to aListof entities.<T> ListenableFuture<Void>select(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Consumer<T> entityConsumer, Class<T> entityClass) Deprecated, for removal: This API element is subject to removal in a future version.Execute aSELECTquery and convert the resulting items notifyingConsumerfor each entity.<T> ListenableFuture<List<T>>Deprecated, for removal: This API element is subject to removal in a future version.Execute aSELECTquery and convert the resulting items to aListof entities.<T> ListenableFuture<Void>Deprecated, for removal: This API element is subject to removal in a future version.Execute aSELECTquery and convert the resulting items notifyingConsumerfor each entity.<T> ListenableFuture<List<T>>Deprecated, for removal: This API element is subject to removal in a future version.Execute aSELECTquery and convert the resulting items to aListof entities.<T> ListenableFuture<Void>Deprecated, for removal: This API element is subject to removal in a future version.Execute aSELECTquery and convert the resulting items notifyingConsumerfor each entity.<T> ListenableFuture<T>Deprecated, for removal: This API element is subject to removal in a future version.Execute aSELECTquery and convert the resulting item to an entity.<T> ListenableFuture<T>Deprecated, for removal: This API element is subject to removal in a future version.Execute aSELECTquery and convert the resulting item to an entity.<T> ListenableFuture<T>Deprecated, for removal: This API element is subject to removal in a future version.Execute aSELECTquery and convert the resulting item to an entity.<T> ListenableFuture<T>selectOneById(Object id, Class<T> entityClass) Deprecated, for removal: This API element is subject to removal in a future version.Execute the Select byidfor the givenentityClass.voidsetApplicationContext(ApplicationContext applicationContext) Deprecated, for removal: This API element is subject to removal in a future version.voidsetApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) Deprecated, for removal: This API element is subject to removal in a future version.voidsetEntityCallbacks(EntityCallbacks entityCallbacks) Deprecated, for removal: This API element is subject to removal in a future version.ConfigureEntityCallbacksto pre-/post-process entities during persistence operations.voidsetEntityLifecycleEventsEnabled(boolean enabled) Deprecated, for removal: This API element is subject to removal in a future version.Configure whether lifecycle events such asAfterLoadEvent,BeforeSaveEvent, etc. should be published or whether emission should be suppressed.voidsetUsePreparedStatements(boolean usePreparedStatements) Deprecated, for removal: This API element is subject to removal in a future version.Enable/disableprepared statementsusage.<T> ListenableFuture<Slice<T>>Deprecated, for removal: This API element is subject to removal in a future version.Execute aSELECTquery with paging and convert the result set to aSliceof entities.<T> ListenableFuture<Slice<T>>Deprecated, for removal: This API element is subject to removal in a future version.Execute aSELECTquery with paging and convert the result set to aSliceof entities.Deprecated, for removal: This API element is subject to removal in a future version.Execute aTRUNCATEquery to remove all entities of a given class.Deprecated, for removal: This API element is subject to removal in a future version.Update the queried entities and return true if the update was applied.<T> ListenableFuture<T>update(T entity) Deprecated, for removal: This API element is subject to removal in a future version.Update the given entity and return the entity if the update was applied.<T> ListenableFuture<EntityWriteResult<T>>update(T entity, UpdateOptions options) Deprecated, for removal: This API element is subject to removal in a future version.Update the given entity applyingWriteOptionsand return the entity if the update was applied.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.cassandra.core.legacy.AsyncCassandraOperations
delete
-
Constructor Details
-
AsyncCassandraTemplate
public AsyncCassandraTemplate(com.datastax.oss.driver.api.core.CqlSession session) Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance ofAsyncCassandraTemplateinitialized with the givenCqlSessionand a defaultMappingCassandraConverter.- Parameters:
session-CqlSessionused to interact with Cassandra; must not be null.- See Also:
-
CassandraConverterCqlSession
-
AsyncCassandraTemplate
public AsyncCassandraTemplate(com.datastax.oss.driver.api.core.CqlSession session, CassandraConverter converter) Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance ofAsyncCassandraTemplateinitialized with the givenCqlSessionandCassandraConverter.- Parameters:
session-CqlSessionused to interact with Cassandra; must not be null.converter-CassandraConverterused to convert between Java and Cassandra types; must not be null.- See Also:
-
CassandraConverterCqlSession
-
AsyncCassandraTemplate
Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance ofAsyncCassandraTemplateinitialized with the givenSessionFactoryandCassandraConverter.- Parameters:
sessionFactory-SessionFactoryused to interact with Cassandra; must not be null.converter-CassandraConverterused to convert between Java and Cassandra types; must not be null.- See Also:
-
CassandraConverterCqlSession
-
AsyncCassandraTemplate
Deprecated, for removal: This API element is subject to removal in a future version.Creates an instance ofAsyncCassandraTemplateinitialized with the givenAsyncCqlTemplateandCassandraConverter.- Parameters:
asyncCqlTemplate-AsyncCqlTemplateused to interact with Cassandra; must not be null.converter-CassandraConverterused to convert between Java and Cassandra types; must not be null.- See Also:
-
CassandraConverterCqlSession
-
-
Method Details
-
setApplicationEventPublisher
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
setApplicationEventPublisherin interfaceApplicationEventPublisherAware
-
setApplicationContext
Deprecated, for removal: This API element is subject to removal in a future version.- Specified by:
setApplicationContextin interfaceApplicationContextAware- Throws:
BeansException
-
setEntityCallbacks
Deprecated, for removal: This API element is subject to removal in a future version.ConfigureEntityCallbacksto pre-/post-process entities during persistence operations.- Parameters:
entityCallbacks-
-
setEntityLifecycleEventsEnabled
public void setEntityLifecycleEventsEnabled(boolean enabled) Deprecated, for removal: This API element is subject to removal in a future version.Configure whether lifecycle events such asAfterLoadEvent,BeforeSaveEvent, etc. should be published or whether emission should be suppressed. Enabled by default.- Parameters:
enabled-trueto enable entity lifecycle events;falseto disable entity lifecycle events.- Since:
- 4.0
- See Also:
-
getAsyncCqlOperations
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExpose the underlyingAsyncCqlOperationsto allow asynchronous CQL operations.- Specified by:
getAsyncCqlOperationsin interfaceAsyncCassandraOperations- Returns:
- the underlying
AsyncCqlOperations. - See Also:
-
getConverter
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsReturns the underlyingCassandraConverter.- Specified by:
getConverterin interfaceAsyncCassandraOperations- Returns:
- the underlying
CassandraConverter.
-
isUsePreparedStatements
public boolean isUsePreparedStatements()Deprecated, for removal: This API element is subject to removal in a future version.Returns whether this instance is configured to useprepared statements. If enabled (default), then all persistence methods (such asselect(java.lang.String, java.lang.Class<T>),update(org.springframework.data.cassandra.core.query.Query, org.springframework.data.cassandra.core.query.Update, java.lang.Class<?>), and others) will make use of prepared statements. Note that methods accepting aStatementmust be called withSimpleStatementinstances to participate in statement preparation.- Returns:
- true if prepared statements usage is enabled; false otherwise.
- Since:
- 3.2
-
setUsePreparedStatements
public void setUsePreparedStatements(boolean usePreparedStatements) Deprecated, for removal: This API element is subject to removal in a future version.Enable/disableprepared statementsusage. If enabled (default), then all persistence methods (such asselect(java.lang.String, java.lang.Class<T>),update(org.springframework.data.cassandra.core.query.Query, org.springframework.data.cassandra.core.query.Update, java.lang.Class<?>), and others) will make use of prepared statements. Note that methods accepting aStatementmust be called withSimpleStatementinstances to participate in statement preparation.- Parameters:
usePreparedStatements- whether to use prepared statements.- Since:
- 3.2
-
getEntityOperations
protected org.springframework.data.cassandra.core.legacy.EntityOperations getEntityOperations()Deprecated, for removal: This API element is subject to removal in a future version.Returns theEntityOperationsused to perform data access operations on an entity inside a Cassandra data source.- Returns:
- the configured
EntityOperationsfor this template. - See Also:
-
EntityOperations
-
getProjectionFactory
Deprecated.since 3.4, useCassandraConverter.getProjectionFactory()instead.Returns a reference to the configuredProjectionFactoryused by this template to process CQL query projections.- Returns:
- a reference to the configured
ProjectionFactoryused by this template to process CQL query projections. - Since:
- 2.1
- See Also:
-
getStatementFactory
Deprecated, for removal: This API element is subject to removal in a future version.Returns theStatementFactoryused by this template to construct and run Cassandra CQL statements.- Returns:
- the
StatementFactoryused by this template to construct and run Cassandra CQL statements. - Since:
- 2.1
- See Also:
-
select
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute aSELECTquery and convert the resulting items to aListof entities.- Specified by:
selectin interfaceAsyncCassandraOperations- Parameters:
cql- must not be null.entityClass- The entity type must not be null.- Returns:
- the converted results
-
select
public <T> ListenableFuture<Void> select(String cql, Consumer<T> entityConsumer, Class<T> entityClass) throws DataAccessException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute aSELECTquery and convert the resulting items notifyingConsumerfor each entity.- Specified by:
selectin interfaceAsyncCassandraOperations- Parameters:
cql- must not be null.entityConsumer- object that will be notified on each entity, one object at a time, must not be null.entityClass- The entity type must not be null.- Returns:
- the completion handle
- Throws:
DataAccessException- if there is any problem executing the query.
-
selectOne
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute aSELECTquery and convert the resulting item to an entity.- Specified by:
selectOnein interfaceAsyncCassandraOperations- Parameters:
cql- must not be null.entityClass- The entity type must not be null.- Returns:
- the converted object or null.
-
execute
public ListenableFuture<com.datastax.oss.driver.api.core.cql.AsyncResultSet> execute(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws DataAccessException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute the given CassandraStatement. Any errors that result from executing this command will be converted into Spring's DAO exception hierarchy.- Specified by:
executein interfaceAsyncCassandraOperations- Parameters:
statement- a CassandraStatement, must not be null.- Returns:
- the
AsyncResultSet. - Throws:
DataAccessException- if there is any problem executing the query.
-
select
public <T> ListenableFuture<List<T>> select(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> entityClass) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute aSELECTquery and convert the resulting items to aListof entities.- Specified by:
selectin interfaceAsyncCassandraOperations- Parameters:
statement- must not be null.entityClass- The entity type must not be null.- Returns:
- the converted results
-
select
public <T> ListenableFuture<Void> select(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Consumer<T> entityConsumer, Class<T> entityClass) throws DataAccessException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute aSELECTquery and convert the resulting items notifyingConsumerfor each entity.- Specified by:
selectin interfaceAsyncCassandraOperations- Parameters:
statement- must not be null.entityConsumer- object that will be notified on each entity, one object at a time, must not be null.entityClass- The entity type must not be null.- Returns:
- the completion handle
- Throws:
DataAccessException- if there is any problem executing the query.
-
selectOne
public <T> ListenableFuture<T> selectOne(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> entityClass) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute aSELECTquery and convert the resulting item to an entity.- Specified by:
selectOnein interfaceAsyncCassandraOperations- Parameters:
statement- must not be null.entityClass- The entity type must not be null.- Returns:
- the converted object or null.
-
slice
public <T> ListenableFuture<Slice<T>> slice(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> entityClass) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute aSELECTquery with paging and convert the result set to aSliceof entities. A sliced query translates the effectivefetch sizeto the page size.- Specified by:
slicein interfaceAsyncCassandraOperations- Parameters:
statement- the CQL statement, must not be null.entityClass- The entity type must not be null.- Returns:
- the converted results
- See Also:
-
select
public <T> ListenableFuture<List<T>> select(Query query, Class<T> entityClass) throws DataAccessException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute aSELECTquery and convert the resulting items to aListof entities.- Specified by:
selectin interfaceAsyncCassandraOperations- Parameters:
query- must not be null.entityClass- The entity type must not be null.- Returns:
- the converted results
- Throws:
DataAccessException- if there is any problem executing the query.
-
select
public <T> ListenableFuture<Void> select(Query query, Consumer<T> entityConsumer, Class<T> entityClass) throws DataAccessException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute aSELECTquery and convert the resulting items notifyingConsumerfor each entity.- Specified by:
selectin interfaceAsyncCassandraOperations- Parameters:
query- must not be null.entityConsumer- object that will be notified on each entity, one object at a time, must not be null.entityClass- The entity type must not be null.- Returns:
- the completion handle
- Throws:
DataAccessException- if there is any problem executing the query.
-
selectOne
public <T> ListenableFuture<T> selectOne(Query query, Class<T> entityClass) throws DataAccessException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute aSELECTquery and convert the resulting item to an entity.- Specified by:
selectOnein interfaceAsyncCassandraOperations- Parameters:
query- must not be null.entityClass- The entity type must not be null.- Returns:
- the converted object or null.
- Throws:
DataAccessException- if there is any problem executing the query.
-
slice
public <T> ListenableFuture<Slice<T>> slice(Query query, Class<T> entityClass) throws DataAccessException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute aSELECTquery with paging and convert the result set to aSliceof entities.- Specified by:
slicein interfaceAsyncCassandraOperations- Parameters:
query- the query object used to create a CQL statement, must not be null.entityClass- The entity type must not be null.- Returns:
- the converted results
- Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
update
public ListenableFuture<Boolean> update(Query query, Update update, Class<?> entityClass) throws DataAccessException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsUpdate the queried entities and return true if the update was applied.- Specified by:
updatein interfaceAsyncCassandraOperations- Parameters:
query- must not be null.update- must not be null.entityClass- The entity type must not be null.- Throws:
DataAccessException- if there is any problem executing the query.
-
delete
public ListenableFuture<Boolean> delete(Query query, Class<?> entityClass) throws DataAccessException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsRemove entities (rows)/columns from the table byQuery.- Specified by:
deletein interfaceAsyncCassandraOperations- Parameters:
query- must not be null.entityClass- The entity type must not be null.- Returns:
- true if the deletion was applied.
- Throws:
DataAccessException- if there is any problem executing the query.
-
count
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsReturns the number of rows for the given entity class.- Specified by:
countin interfaceAsyncCassandraOperations- Parameters:
entityClass-typeof the entity; must not be null.- Returns:
- the number of existing entities.
-
count
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsReturns the number of rows for the given entity class applyingQuery. This overridden method allows users to further refine the selection criteria using aQuerypredicate to determine how many entities of the giventypematch the criteria.- Specified by:
countin interfaceAsyncCassandraOperations- Parameters:
query- user-provided countQueryto execute; must not be null.entityClass-typeof the entity; must not be null.- Returns:
- the number of existing entities.
- Throws:
DataAccessException- if any problem occurs while executing the query.
-
exists
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsDetermine whether a row ofentityClasswith the givenidexists.- Specified by:
existsin interfaceAsyncCassandraOperations- Parameters:
id- Id value. For single primary keys it's the plain value. For composite primary keys either, it's an instance of eitherPrimaryKeyClassorMapId. Must not be null.entityClass-typeof the entity; must not be null.- Returns:
- true if the object exists.
-
exists
public ListenableFuture<Boolean> exists(Query query, Class<?> entityClass) throws DataAccessException Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsDetermine whether the result forentityClassQueryyields at least one row.- Specified by:
existsin interfaceAsyncCassandraOperations- Parameters:
query- user-provided existsQueryto execute; must not be null.entityClass-typeof the entity; must not be null.- Returns:
- true if the object exists.
- Throws:
DataAccessException- if any problem occurs while executing the query.
-
selectOneById
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute the Select byidfor the givenentityClass.- Specified by:
selectOneByIdin interfaceAsyncCassandraOperations- Parameters:
id- the Id value. For single primary keys it's the plain value. For composite primary keys either thePrimaryKeyClassorMapId. Must not be null.entityClass- The entity type must not be null.- Returns:
- the converted object or null.
-
insert
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsInsert the given entity and return the entity if the insert was applied.- Specified by:
insertin interfaceAsyncCassandraOperations- Parameters:
entity- The entity to insert, must not be null.- Returns:
- the inserted entity.
-
insert
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsInsert the given entity applyingWriteOptionsand return the entity if the insert was applied.- Specified by:
insertin interfaceAsyncCassandraOperations- Parameters:
entity- The entity to insert, must not be null.options- must not be null.- Returns:
- the
EntityWriteResultfor this operation. - See Also:
-
update
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsUpdate the given entity and return the entity if the update was applied.- Specified by:
updatein interfaceAsyncCassandraOperations- Parameters:
entity- The entity to update, must not be null.- Returns:
- the updated entity.
-
update
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsUpdate the given entity applyingWriteOptionsand return the entity if the update was applied.- Specified by:
updatein interfaceAsyncCassandraOperations- Parameters:
entity- The entity to update, must not be null.options- must not be null.- Returns:
- the
EntityWriteResultfor this operation. - See Also:
-
delete
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsDelete the given entity and return the entity if the delete statement was applied.- Specified by:
deletein interfaceAsyncCassandraOperations- Parameters:
entity- must not be null.- Returns:
- the deleted entity.
-
delete
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsDelete the given entity applyingQueryOptionsand return the entity if the delete statement was applied.- Specified by:
deletein interfaceAsyncCassandraOperations- Parameters:
entity- must not be null.options- must not be null.- Returns:
- the
WriteResultfor this operation. - See Also:
-
deleteById
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsRemove the given object from the table by id.- Specified by:
deleteByIdin interfaceAsyncCassandraOperations- Parameters:
id- the Id value. For single primary keys it's the plain value. For composite primary keys either thePrimaryKeyClassorMapId. Must not be null.entityClass- The entity type must not be null.- Returns:
- true if the deletion was applied.
-
truncate
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:AsyncCassandraOperationsExecute aTRUNCATEquery to remove all entities of a given class.- Specified by:
truncatein interfaceAsyncCassandraOperations- Parameters:
entityClass- The entity type must not be null.
-
createPreparedStatementHandler
protected AsyncCassandraTemplate.AsyncPreparedStatementHandler createPreparedStatementHandler(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Deprecated, for removal: This API element is subject to removal in a future version.Create a new statement-basedAsyncCassandraTemplate.AsyncPreparedStatementHandlerusing the statement passed in.This method allows for the creation to be overridden by subclasses.
- Parameters:
statement- the statement to be prepared.- Returns:
- the new
AsyncCassandraTemplate.PreparedStatementHandlerto use. - Since:
- 3.3.3
-
maybeEmitEvent
Deprecated, for removal: This API element is subject to removal in a future version. -
maybeCallBeforeConvert
protected <T> T maybeCallBeforeConvert(T object, com.datastax.oss.driver.api.core.CqlIdentifier tableName) Deprecated, for removal: This API element is subject to removal in a future version. -
maybeCallBeforeSave
protected <T> T maybeCallBeforeSave(T object, com.datastax.oss.driver.api.core.CqlIdentifier tableName, com.datastax.oss.driver.api.core.cql.Statement<?> statement) Deprecated, for removal: This API element is subject to removal in a future version.
-
CompletableFuture-based variantAsyncCassandraTemplate.