Interface ReactiveCassandraOperations

All Superinterfaces:
ReactiveDeleteOperation, ReactiveFluentCassandraOperations, ReactiveInsertOperation, ReactiveSelectOperation, ReactiveUpdateOperation
All Known Implementing Classes:
ReactiveCassandraTemplate

public interface ReactiveCassandraOperations extends ReactiveFluentCassandraOperations
Interface specifying a basic set of reactive Cassandra operations. Implemented by ReactiveCassandraTemplate. Not often used directly, but a useful option to enhance testability, as it can easily be mocked or stubbed.
Since:
2.0
Author:
Mark Paluch, Hleb Albau, Oleh Dokuka, Sam Lightfoot
See Also:
  • Method Details

    • batchOps

      Returns a new ReactiveCassandraBatchOperations using BatchType.LOGGED. Each ReactiveCassandraBatchOperations instance can be executed only once, so you need to obtain new ReactiveCassandraBatchOperations instances for each batch.
      Returns:
      a new ReactiveCassandraBatchOperations associated with the given entity class.
      Since:
      2.1
      See Also:
    • batchOps

      ReactiveCassandraBatchOperations batchOps(com.datastax.oss.driver.api.core.cql.BatchType batchType)
      Returns a new ReactiveCassandraBatchOperations. Each ReactiveCassandraBatchOperations instance can be executed only once, so you need to obtain new ReactiveCassandraBatchOperations instances for each batch.
      Parameters:
      batchType - must not be null.
      Returns:
      a new ReactiveCassandraBatchOperations associated with the given entity class.
      Since:
      3.2.6
    • getReactiveCqlOperations

      ReactiveCqlOperations getReactiveCqlOperations()
      Expose the underlying ReactiveCqlOperations to allow CQL operations.
      Returns:
      the underlying ReactiveCqlOperations.
      See Also:
    • getConverter

      CassandraConverter getConverter()
      Returns the underlying CassandraConverter.
      Returns:
      the underlying CassandraConverter.
    • select

      <T> reactor.core.publisher.Flux<T> select(String cql, Class<T> entityClass) throws DataAccessException
      Execute a SELECT query and convert the resulting items to a stream of entities.
      Parameters:
      cql - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the converted results
      Throws:
      DataAccessException - if there is any problem issuing the execution.
    • selectOne

      <T> reactor.core.publisher.Mono<T> selectOne(String cql, Class<T> entityClass) throws DataAccessException
      Execute a SELECT query and convert the resulting item to an entity.
      Parameters:
      cql - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the result object returned by the action or Mono.empty()
      Throws:
      DataAccessException - if there is any problem issuing the execution.
    • select

      <T> reactor.core.publisher.Flux<T> select(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> entityClass) throws DataAccessException
      Execute a SELECT query and convert the resulting items to a stream of entities.
      Parameters:
      statement - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the result objects returned by the action.
      Throws:
      DataAccessException - if there is any problem issuing the execution.
    • slice

      <T> reactor.core.publisher.Mono<Slice<T>> slice(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> entityClass) throws DataAccessException
      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.
      Parameters:
      statement - the CQL statement, must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the result object returned by the action or Mono.just(Object) of an empty Slice.
      Throws:
      DataAccessException - if there is any problem executing the query.
      Since:
      2.1
    • selectOne

      <T> reactor.core.publisher.Mono<T> selectOne(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> entityClass) throws DataAccessException
      Execute a SELECT query and convert the resulting item to an entity.
      Parameters:
      statement - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the result object returned by the action or Mono.empty()
      Throws:
      DataAccessException - if there is any problem issuing the execution.
    • execute

      reactor.core.publisher.Mono<ReactiveResultSet> execute(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws DataAccessException
      Execute the a Cassandra Statement. Any errors that result from executing this command will be converted into Spring's DAO exception hierarchy.
      Parameters:
      statement - a Cassandra Statement, must not be null.
      Returns:
      the ReactiveResultSet.
      Throws:
      DataAccessException - if there is any problem issuing the execution.
      Since:
      3.2
    • select

      <T> reactor.core.publisher.Flux<T> select(Query query, Class<T> entityClass) throws DataAccessException
      Execute a SELECT query and convert the resulting items to a stream of entities.
      Parameters:
      query - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the result objects returned by the action.
      Throws:
      DataAccessException - if there is any problem issuing the execution.
    • slice

      <T> reactor.core.publisher.Mono<Slice<T>> slice(Query query, Class<T> entityClass) throws DataAccessException
      Execute a SELECT query with paging and convert the result set to a Slice of entities.
      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 result object returned by the action or Mono.just(Object) of an empty Slice.
      Throws:
      DataAccessException - if there is any problem executing the query.
      Since:
      2.1
      See Also:
    • selectOne

      <T> reactor.core.publisher.Mono<T> selectOne(Query query, Class<T> entityClass) throws DataAccessException
      Execute a SELECT query and convert the resulting item to an entity.
      Parameters:
      query - must not be null.
      entityClass - The entity type must not be null.
      Returns:
      the result object returned by the action or Mono.empty().
      Throws:
      DataAccessException - if there is any problem issuing the execution.
    • update

      reactor.core.publisher.Mono<Boolean> update(Query query, Update update, Class<?> entityClass) throws DataAccessException
      Update the queried entities and return true if the update was applied.
      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

      reactor.core.publisher.Mono<Boolean> delete(Query query, Class<?> entityClass) throws DataAccessException
      Remove entities (rows)/columns from the table by Query.
      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 issuing the execution.
    • count

      reactor.core.publisher.Mono<Long> count(Class<?> entityClass) throws DataAccessException
      Returns the number of rows for the given entity class.
      Parameters:
      entityClass - type of the entity; must not be null.
      Returns:
      the number of existing entities.
      Throws:
      DataAccessException - if any problem occurs while executing the query.
    • count

      reactor.core.publisher.Mono<Long> count(Query query, Class<?> entityClass) throws DataAccessException
      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.
      Parameters:
      query - user-defined count Query to execute; must not be null.
      entityClass - type of the entity; must not be null.
      Returns:
      the number of existing entities.
      Throws:
      DataAccessException - if any problem occurs while executing the query.
      Since:
      2.1
    • exists

      reactor.core.publisher.Mono<Boolean> exists(Object id, Class<?> entityClass) throws DataAccessException
      Determine whether a row of entityClass with the given id exists.
      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.
      Throws:
      DataAccessException - if any problem occurs while executing the query.
    • exists

      reactor.core.publisher.Mono<Boolean> exists(Query query, Class<?> entityClass) throws DataAccessException
      Determine whether the result for entityClass Query yields at least one row.
      Parameters:
      query - user-defined exists Query to execute; must not be null.
      entityClass - type of the entity; must not be null.
      Returns:
      true if the object exists.
      Throws:
      DataAccessException - if any problem occurs while executing the query.
      Since:
      2.1
    • selectOneById

      <T> reactor.core.publisher.Mono<T> selectOneById(Object id, Class<T> entityClass) throws DataAccessException
      Execute the Select by id for the given entityClass.
      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 result object returned by the action or Mono.empty()
      Throws:
      DataAccessException - if there is any problem issuing the execution.
    • insert

      <T> reactor.core.publisher.Mono<T> insert(T entity) throws DataAccessException
      Insert the given entity and emit the entity if the insert was applied.
      Parameters:
      entity - The entity to insert, must not be null.
      Returns:
      the inserted entity.
      Throws:
      DataAccessException - if there is any problem issuing the execution.
    • insert

      <T> reactor.core.publisher.Mono<EntityWriteResult<T>> insert(T entity, InsertOptions options) throws DataAccessException
      Insert the given entity applying WriteOptions and emit the entity if the insert was applied.
      Parameters:
      entity - The entity to insert, must not be null.
      options - must not be null.
      Returns:
      the EntityWriteResult for this operation.
      Throws:
      DataAccessException - if there is any problem issuing the execution.
      See Also:
    • update

      <T> reactor.core.publisher.Mono<T> update(T entity) throws DataAccessException
      Update the given entity and emit the entity if the update was applied.
      Parameters:
      entity - The entity to update, must not be null.
      Returns:
      the updated entity.
      Throws:
      DataAccessException - if there is any problem issuing the execution.
    • update

      <T> reactor.core.publisher.Mono<EntityWriteResult<T>> update(T entity, UpdateOptions options) throws DataAccessException
      Update the given entity applying WriteOptions and emit the entity if the update was applied.
      Parameters:
      entity - The entity to update, must not be null.
      options - must not be null.
      Returns:
      the EntityWriteResult for this operation.
      Throws:
      DataAccessException - if there is any problem issuing the execution.
      See Also:
    • delete

      <T> reactor.core.publisher.Mono<T> delete(T entity) throws DataAccessException
      Delete the given entity and emit the entity if the delete was applied.
      Parameters:
      entity - must not be null.
      Returns:
      the deleted entity.
      Throws:
      DataAccessException - if there is any problem issuing the execution.
    • delete

      reactor.core.publisher.Mono<WriteResult> delete(Object entity, QueryOptions options) throws DataAccessException
      Delete the given entity applying QueryOptions and emit the entity if the delete was applied.
      Parameters:
      entity - must not be null.
      options - must not be null.
      Returns:
      the WriteResult for this operation.
      Throws:
      DataAccessException - if there is any problem issuing the execution.
      See Also:
    • delete

      default reactor.core.publisher.Mono<WriteResult> delete(Object entity, DeleteOptions options) throws DataAccessException
      Delete the given entity applying QueryOptions and emit the entity if the delete was applied.
      Parameters:
      entity - must not be null.
      options - must not be null.
      Returns:
      the WriteResult for this operation.
      Throws:
      DataAccessException - if there is any problem issuing the execution.
      Since:
      2.2
      See Also:
    • deleteById

      reactor.core.publisher.Mono<Boolean> deleteById(Object id, Class<?> entityClass) throws DataAccessException
      Remove the given object from the table by id.
      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.
      Throws:
      DataAccessException - if there is any problem issuing the execution.
    • truncate

      reactor.core.publisher.Mono<Void> truncate(Class<?> entityClass) throws DataAccessException
      Execute a TRUNCATE query to remove all entities of a given class.
      Parameters:
      entityClass - The entity type must not be null.
      Throws:
      DataAccessException - if there is any problem issuing the execution.