Class AsyncCassandraTemplate

java.lang.Object
org.springframework.data.cassandra.core.legacy.AsyncCassandraTemplate
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationEventPublisherAware, AsyncCassandraOperations

@Deprecated(since="4.0", forRemoval=true) public class AsyncCassandraTemplate extends Object implements AsyncCassandraOperations, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.ApplicationContextAware
Deprecated, for removal: This API element is subject to removal in a future version.
since 4.0, use the CompletableFuture-based variant AsyncCassandraTemplate.
Primary implementation of 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 Classes
    Modifier and Type
    Class
    Description
    static interface 
    Deprecated, 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 class 
    Deprecated, for removal: This API element is subject to removal in a future version.
    Utility class to prepare a SimpleStatement and bind values associated with the statement to a BoundStatement.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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 of AsyncCassandraTemplate initialized with the given CqlSession and a default MappingCassandraConverter.
    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 of AsyncCassandraTemplate initialized with the given CqlSession and CassandraConverter.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates an instance of AsyncCassandraTemplate initialized with the given AsyncCqlTemplate and CassandraConverter.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Creates an instance of AsyncCassandraTemplate initialized with the given SessionFactory and CassandraConverter.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.util.concurrent.ListenableFuture<Long>
    count(Class<?> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the number of rows for the given entity class.
    org.springframework.util.concurrent.ListenableFuture<Long>
    count(Query query, Class<?> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the number of rows for the given entity class applying Query.
    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-based AsyncCassandraTemplate.AsyncPreparedStatementHandler using the statement passed in.
    org.springframework.util.concurrent.ListenableFuture<WriteResult>
    delete(Object entity, QueryOptions options)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Delete the given entity applying QueryOptions and return the entity if the delete statement was applied.
    org.springframework.util.concurrent.ListenableFuture<Boolean>
    delete(Query query, Class<?> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Remove entities (rows)/columns from the table by Query.
    <T> org.springframework.util.concurrent.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.
    org.springframework.util.concurrent.ListenableFuture<Boolean>
    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.
    org.springframework.util.concurrent.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 Cassandra Statement.
    org.springframework.util.concurrent.ListenableFuture<Boolean>
    exists(Object id, Class<?> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Determine whether a row of entityClass with the given id exists.
    org.springframework.util.concurrent.ListenableFuture<Boolean>
    exists(Query query, Class<?> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Determine whether the result for entityClass Query yields at least one row.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Expose the underlying AsyncCqlOperations to allow asynchronous CQL operations.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the underlying CassandraConverter.
    protected org.springframework.data.cassandra.core.legacy.EntityOperations
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the EntityOperations used to perform data access operations on an entity inside a Cassandra data source.
    protected org.springframework.data.projection.SpelAwareProxyProjectionFactory
    Deprecated.
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns the StatementFactory used by this template to construct and run Cassandra CQL statements.
    <T> org.springframework.util.concurrent.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> org.springframework.util.concurrent.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 applying WriteOptions and return the entity if the insert was applied.
    boolean
    Deprecated, for removal: This API element is subject to removal in a future version.
    Returns whether this instance is configured to use prepared statements.
    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.
     
    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.
     
    protected <E extends CassandraMappingEvent<T>, T>
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    <T> org.springframework.util.concurrent.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.
    Execute a SELECT query and convert the resulting items to a List of entities.
    <T> org.springframework.util.concurrent.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 a SELECT query and convert the resulting items notifying Consumer for each entity.
    <T> org.springframework.util.concurrent.ListenableFuture<List<T>>
    select(String cql, Class<T> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Execute a SELECT query and convert the resulting items to a List of entities.
    <T> org.springframework.util.concurrent.ListenableFuture<Void>
    select(String cql, Consumer<T> entityConsumer, Class<T> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Execute a SELECT query and convert the resulting items notifying Consumer for each entity.
    <T> org.springframework.util.concurrent.ListenableFuture<List<T>>
    select(Query query, Class<T> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Execute a SELECT query and convert the resulting items to a List of entities.
    <T> org.springframework.util.concurrent.ListenableFuture<Void>
    select(Query query, Consumer<T> entityConsumer, Class<T> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Execute a SELECT query and convert the resulting items notifying Consumer for each entity.
    <T> org.springframework.util.concurrent.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.
    Execute a SELECT query and convert the resulting item to an entity.
    <T> org.springframework.util.concurrent.ListenableFuture<T>
    selectOne(String cql, Class<T> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Execute a SELECT query and convert the resulting item to an entity.
    <T> org.springframework.util.concurrent.ListenableFuture<T>
    selectOne(Query query, Class<T> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Execute a SELECT query and convert the resulting item to an entity.
    <T> org.springframework.util.concurrent.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 by id for the given entityClass.
    void
    setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    setEntityCallbacks(org.springframework.data.mapping.callback.EntityCallbacks entityCallbacks)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Configure EntityCallbacks to pre-/post-process entities during persistence operations.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Configure whether lifecycle events such as AfterLoadEvent, BeforeSaveEvent, etc. should be published or whether emission should be suppressed.
    void
    setUsePreparedStatements(boolean usePreparedStatements)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Enable/disable prepared statements usage.
    <T> org.springframework.util.concurrent.ListenableFuture<org.springframework.data.domain.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.
    Execute a SELECT query with paging and convert the result set to a Slice of entities.
    <T> org.springframework.util.concurrent.ListenableFuture<org.springframework.data.domain.Slice<T>>
    slice(Query query, Class<T> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Execute a SELECT query with paging and convert the result set to a Slice of entities.
    org.springframework.util.concurrent.ListenableFuture<Void>
    truncate(Class<?> entityClass)
    Deprecated, for removal: This API element is subject to removal in a future version.
    Execute a TRUNCATE query to remove all entities of a given class.
    org.springframework.util.concurrent.ListenableFuture<Boolean>
    update(Query query, Update update, Class<?> entityClass)
    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> org.springframework.util.concurrent.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> org.springframework.util.concurrent.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 applying WriteOptions and 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, wait

    Methods inherited from interface org.springframework.data.cassandra.core.legacy.AsyncCassandraOperations

    delete
  • Constructor Details

  • Method Details

    • setApplicationEventPublisher

      public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware
    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • setEntityCallbacks

      public void setEntityCallbacks(@Nullable org.springframework.data.mapping.callback.EntityCallbacks entityCallbacks)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Configure EntityCallbacks to 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 as AfterLoadEvent, BeforeSaveEvent, etc. should be published or whether emission should be suppressed. Enabled by default.
      Parameters:
      enabled - true to enable entity lifecycle events; false to disable entity lifecycle events.
      Since:
      4.0
      See Also:
    • getAsyncCqlOperations

      public AsyncCqlOperations getAsyncCqlOperations()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Expose the underlying AsyncCqlOperations to allow asynchronous CQL operations.
      Specified by:
      getAsyncCqlOperations in interface AsyncCassandraOperations
      Returns:
      the underlying AsyncCqlOperations.
      See Also:
    • getConverter

      public CassandraConverter getConverter()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Returns the underlying CassandraConverter.
      Specified by:
      getConverter in interface AsyncCassandraOperations
      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 use prepared statements. If enabled (default), then all persistence methods (such as select(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 a Statement must be called with SimpleStatement instances 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/disable prepared statements usage. If enabled (default), then all persistence methods (such as select(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 a Statement must be called with SimpleStatement instances 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 the EntityOperations used to perform data access operations on an entity inside a Cassandra data source.
      Returns:
      the configured EntityOperations for this template.
      See Also:
      • EntityOperations
    • getProjectionFactory

      @Deprecated protected org.springframework.data.projection.SpelAwareProxyProjectionFactory getProjectionFactory()
      Deprecated.
      Returns a reference to the configured ProjectionFactory used by this template to process CQL query projections.
      Returns:
      a reference to the configured ProjectionFactory used by this template to process CQL query projections.
      Since:
      2.1
      See Also:
      • SpelAwareProxyProjectionFactory
    • getStatementFactory

      protected StatementFactory getStatementFactory()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the StatementFactory used by this template to construct and run Cassandra CQL statements.
      Returns:
      the StatementFactory used by this template to construct and run Cassandra CQL statements.
      Since:
      2.1
      See Also:
    • select

      public <T> org.springframework.util.concurrent.ListenableFuture<List<T>> select(String cql, Class<T> entityClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Execute a SELECT query and convert the resulting items to a List of entities.
      Specified by:
      select in interface AsyncCassandraOperations
      Parameters:
      cql - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the converted results
    • select

      public <T> org.springframework.util.concurrent.ListenableFuture<Void> select(String cql, Consumer<T> entityConsumer, Class<T> entityClass) throws org.springframework.dao.DataAccessException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Execute a SELECT query and convert the resulting items notifying Consumer for each entity.
      Specified by:
      select in interface AsyncCassandraOperations
      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:
      org.springframework.dao.DataAccessException - if there is any problem executing the query.
    • selectOne

      public <T> org.springframework.util.concurrent.ListenableFuture<T> selectOne(String cql, Class<T> entityClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Execute a SELECT query and convert the resulting item to an entity.
      Specified by:
      selectOne in interface AsyncCassandraOperations
      Parameters:
      cql - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the converted object or null.
    • execute

      public org.springframework.util.concurrent.ListenableFuture<com.datastax.oss.driver.api.core.cql.AsyncResultSet> execute(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws org.springframework.dao.DataAccessException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Execute the given Cassandra Statement. Any errors that result from executing this command will be converted into Spring's DAO exception hierarchy.
      Specified by:
      execute in interface AsyncCassandraOperations
      Parameters:
      statement - a Cassandra Statement, must not be null.
      Returns:
      the AsyncResultSet.
      Throws:
      org.springframework.dao.DataAccessException - if there is any problem executing the query.
    • select

      public <T> org.springframework.util.concurrent.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: AsyncCassandraOperations
      Execute a SELECT query and convert the resulting items to a List of entities.
      Specified by:
      select in interface AsyncCassandraOperations
      Parameters:
      statement - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the converted results
    • select

      public <T> org.springframework.util.concurrent.ListenableFuture<Void> select(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Consumer<T> entityConsumer, Class<T> entityClass) throws org.springframework.dao.DataAccessException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Execute a SELECT query and convert the resulting items notifying Consumer for each entity.
      Specified by:
      select in interface AsyncCassandraOperations
      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:
      org.springframework.dao.DataAccessException - if there is any problem executing the query.
    • selectOne

      public <T> org.springframework.util.concurrent.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: AsyncCassandraOperations
      Execute a SELECT query and convert the resulting item to an entity.
      Specified by:
      selectOne in interface AsyncCassandraOperations
      Parameters:
      statement - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the converted object or null.
    • slice

      public <T> org.springframework.util.concurrent.ListenableFuture<org.springframework.data.domain.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: AsyncCassandraOperations
      Execute a SELECT query with paging and convert the result set to a Slice of entities. A sliced query translates the effective fetch size to the page size.
      Specified by:
      slice in interface AsyncCassandraOperations
      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> org.springframework.util.concurrent.ListenableFuture<List<T>> select(Query query, Class<T> entityClass) throws org.springframework.dao.DataAccessException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Execute a SELECT query and convert the resulting items to a List of entities.
      Specified by:
      select in interface AsyncCassandraOperations
      Parameters:
      query - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the converted results
      Throws:
      org.springframework.dao.DataAccessException - if there is any problem executing the query.
    • select

      public <T> org.springframework.util.concurrent.ListenableFuture<Void> select(Query query, Consumer<T> entityConsumer, Class<T> entityClass) throws org.springframework.dao.DataAccessException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Execute a SELECT query and convert the resulting items notifying Consumer for each entity.
      Specified by:
      select in interface AsyncCassandraOperations
      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:
      org.springframework.dao.DataAccessException - if there is any problem executing the query.
    • selectOne

      public <T> org.springframework.util.concurrent.ListenableFuture<T> selectOne(Query query, Class<T> entityClass) throws org.springframework.dao.DataAccessException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Execute a SELECT query and convert the resulting item to an entity.
      Specified by:
      selectOne in interface AsyncCassandraOperations
      Parameters:
      query - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the converted object or null.
      Throws:
      org.springframework.dao.DataAccessException - if there is any problem executing the query.
    • slice

      public <T> org.springframework.util.concurrent.ListenableFuture<org.springframework.data.domain.Slice<T>> slice(Query query, Class<T> entityClass) throws org.springframework.dao.DataAccessException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Execute a SELECT query with paging and convert the result set to a Slice of entities.
      Specified by:
      slice in interface AsyncCassandraOperations
      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:
      org.springframework.dao.DataAccessException - if there is any problem executing the query.
      See Also:
    • update

      public org.springframework.util.concurrent.ListenableFuture<Boolean> update(Query query, Update update, Class<?> entityClass) throws org.springframework.dao.DataAccessException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Update the queried entities and return true if the update was applied.
      Specified by:
      update in interface AsyncCassandraOperations
      Parameters:
      query - must not be null.
      update - must not be null.
      entityClass - The entity type must not be null.
      Throws:
      org.springframework.dao.DataAccessException - if there is any problem executing the query.
    • delete

      public org.springframework.util.concurrent.ListenableFuture<Boolean> delete(Query query, Class<?> entityClass) throws org.springframework.dao.DataAccessException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Remove entities (rows)/columns from the table by Query.
      Specified by:
      delete in interface AsyncCassandraOperations
      Parameters:
      query - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      true if the deletion was applied.
      Throws:
      org.springframework.dao.DataAccessException - if there is any problem executing the query.
    • count

      public org.springframework.util.concurrent.ListenableFuture<Long> count(Class<?> entityClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Returns the number of rows for the given entity class.
      Specified by:
      count in interface AsyncCassandraOperations
      Parameters:
      entityClass - type of the entity; must not be null.
      Returns:
      the number of existing entities.
    • count

      public org.springframework.util.concurrent.ListenableFuture<Long> count(Query query, Class<?> entityClass) throws org.springframework.dao.DataAccessException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Returns the number of rows for the given entity class applying Query. This overridden method allows users to further refine the selection criteria using a Query predicate to determine how many entities of the given type match the criteria.
      Specified by:
      count in interface AsyncCassandraOperations
      Parameters:
      query - user-provided count Query to execute; must not be null.
      entityClass - type of the entity; must not be null.
      Returns:
      the number of existing entities.
      Throws:
      org.springframework.dao.DataAccessException - if any problem occurs while executing the query.
    • exists

      public org.springframework.util.concurrent.ListenableFuture<Boolean> exists(Object id, Class<?> entityClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Determine whether a row of entityClass with the given id exists.
      Specified by:
      exists in interface AsyncCassandraOperations
      Parameters:
      id - Id value. For single primary keys it's the plain value. For composite primary keys either, it's an instance of either PrimaryKeyClass or MapId. Must not be null.
      entityClass - type of the entity; must not be null.
      Returns:
      true if the object exists.
    • exists

      public org.springframework.util.concurrent.ListenableFuture<Boolean> exists(Query query, Class<?> entityClass) throws org.springframework.dao.DataAccessException
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Determine whether the result for entityClass Query yields at least one row.
      Specified by:
      exists in interface AsyncCassandraOperations
      Parameters:
      query - user-provided exists Query to execute; must not be null.
      entityClass - type of the entity; must not be null.
      Returns:
      true if the object exists.
      Throws:
      org.springframework.dao.DataAccessException - if any problem occurs while executing the query.
    • selectOneById

      public <T> org.springframework.util.concurrent.ListenableFuture<T> selectOneById(Object id, Class<T> entityClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Execute the Select by id for the given entityClass.
      Specified by:
      selectOneById in interface AsyncCassandraOperations
      Parameters:
      id - the Id value. For single primary keys it's the plain value. For composite primary keys either the PrimaryKeyClass or MapId. Must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the converted object or null.
    • insert

      public <T> org.springframework.util.concurrent.ListenableFuture<T> insert(T entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Insert the given entity and return the entity if the insert was applied.
      Specified by:
      insert in interface AsyncCassandraOperations
      Parameters:
      entity - The entity to insert, must not be null.
      Returns:
      the inserted entity.
    • insert

      public <T> org.springframework.util.concurrent.ListenableFuture<EntityWriteResult<T>> insert(T entity, InsertOptions options)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Insert the given entity applying WriteOptions and return the entity if the insert was applied.
      Specified by:
      insert in interface AsyncCassandraOperations
      Parameters:
      entity - The entity to insert, must not be null.
      options - must not be null.
      Returns:
      the EntityWriteResult for this operation.
      See Also:
    • update

      public <T> org.springframework.util.concurrent.ListenableFuture<T> update(T entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Update the given entity and return the entity if the update was applied.
      Specified by:
      update in interface AsyncCassandraOperations
      Parameters:
      entity - The entity to update, must not be null.
      Returns:
      the updated entity.
    • update

      public <T> org.springframework.util.concurrent.ListenableFuture<EntityWriteResult<T>> update(T entity, UpdateOptions options)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Update the given entity applying WriteOptions and return the entity if the update was applied.
      Specified by:
      update in interface AsyncCassandraOperations
      Parameters:
      entity - The entity to update, must not be null.
      options - must not be null.
      Returns:
      the EntityWriteResult for this operation.
      See Also:
    • delete

      public <T> org.springframework.util.concurrent.ListenableFuture<T> delete(T entity)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Delete the given entity and return the entity if the delete statement was applied.
      Specified by:
      delete in interface AsyncCassandraOperations
      Parameters:
      entity - must not be null.
      Returns:
      the deleted entity.
    • delete

      public org.springframework.util.concurrent.ListenableFuture<WriteResult> delete(Object entity, QueryOptions options)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Delete the given entity applying QueryOptions and return the entity if the delete statement was applied.
      Specified by:
      delete in interface AsyncCassandraOperations
      Parameters:
      entity - must not be null.
      options - must not be null.
      Returns:
      the WriteResult for this operation.
      See Also:
    • deleteById

      public org.springframework.util.concurrent.ListenableFuture<Boolean> deleteById(Object id, Class<?> entityClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Remove the given object from the table by id.
      Specified by:
      deleteById in interface AsyncCassandraOperations
      Parameters:
      id - the Id value. For single primary keys it's the plain value. For composite primary keys either the PrimaryKeyClass or MapId. Must not be null.
      entityClass - The entity type must not be null.
      Returns:
      true if the deletion was applied.
    • truncate

      public org.springframework.util.concurrent.ListenableFuture<Void> truncate(Class<?> entityClass)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Description copied from interface: AsyncCassandraOperations
      Execute a TRUNCATE query to remove all entities of a given class.
      Specified by:
      truncate in interface AsyncCassandraOperations
      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-based AsyncCassandraTemplate.AsyncPreparedStatementHandler using 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.PreparedStatementHandler to use.
      Since:
      3.3.3
    • maybeEmitEvent

      protected <E extends CassandraMappingEvent<T>, T> void maybeEmitEvent(Supplier<E> event)
      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.