Class ReactiveCassandraTemplate
- All Implemented Interfaces:
Aware
,ApplicationContextAware
,ApplicationEventPublisherAware
,ReactiveCassandraOperations
,ReactiveDeleteOperation
,ReactiveFluentCassandraOperations
,ReactiveInsertOperation
,ReactiveSelectOperation
,ReactiveUpdateOperation
ReactiveCassandraOperations
. It simplifies the use of Reactive Cassandra usage and
helps to avoid common errors. It executes core Cassandra workflow. This class executes CQL queries or updates,
initiating iteration over ReactiveResultSet
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 ReactiveSessionFactory
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 ReactiveSessionFactory
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:
- 2.0
- Author:
- Mark Paluch, John Blum, Lukasz Antoniak, Hleb Albau, Sam Lightfoot
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Utility class to prepare aSimpleStatement
and bind values associated with the statement to aBoundStatement
.static interface
General callback interface used to create and bind prepared CQL statements.Nested classes/interfaces inherited from interface org.springframework.data.cassandra.core.ReactiveDeleteOperation
ReactiveDeleteOperation.DeleteWithQuery, ReactiveDeleteOperation.DeleteWithTable, ReactiveDeleteOperation.ReactiveDelete, ReactiveDeleteOperation.TerminatingDelete
Nested classes/interfaces inherited from interface org.springframework.data.cassandra.core.ReactiveInsertOperation
ReactiveInsertOperation.InsertWithOptions<T>, ReactiveInsertOperation.InsertWithTable<T>, ReactiveInsertOperation.ReactiveInsert<T>, ReactiveInsertOperation.TerminatingInsert<T>
Nested classes/interfaces inherited from interface org.springframework.data.cassandra.core.ReactiveSelectOperation
ReactiveSelectOperation.ReactiveSelect<T>, ReactiveSelectOperation.SelectWithProjection<T>, ReactiveSelectOperation.SelectWithQuery<T>, ReactiveSelectOperation.SelectWithTable<T>, ReactiveSelectOperation.TerminatingSelect<T>
Nested classes/interfaces inherited from interface org.springframework.data.cassandra.core.ReactiveUpdateOperation
ReactiveUpdateOperation.ReactiveUpdate, ReactiveUpdateOperation.TerminatingUpdate, ReactiveUpdateOperation.UpdateWithQuery, ReactiveUpdateOperation.UpdateWithTable
-
Constructor Summary
ConstructorDescriptionReactiveCassandraTemplate
(ReactiveCqlOperations reactiveCqlOperations, CassandraConverter converter) Create an instance ofReactiveCassandraTemplate
initialized with the givenReactiveCqlOperations
andCassandraConverter
.ReactiveCassandraTemplate
(ReactiveSession session) Creates an instance ofReactiveCassandraTemplate
initialized with the givenReactiveSession
and a defaultMappingCassandraConverter
.ReactiveCassandraTemplate
(ReactiveSessionFactory sessionFactory, CassandraConverter converter) Create an instance ofReactiveCassandraTemplate
initialized with the givenReactiveSessionFactory
andCassandraConverter
.ReactiveCassandraTemplate
(ReactiveSession session, CassandraConverter converter) Create an instance ofCassandraTemplate
initialized with the givenReactiveSession
andCassandraConverter
. -
Method Summary
Modifier and TypeMethodDescriptionbatchOps
(com.datastax.oss.driver.api.core.cql.BatchType batchType) Returns a newReactiveCassandraBatchOperations
.reactor.core.publisher.Mono<Long>
Returns the number of rows for the given entity class.reactor.core.publisher.Mono<Long>
Returns the number of rows for the given entity class applyingQuery
.createPreparedStatementHandler
(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Create a new statement-basedReactiveCassandraTemplate.ReactivePreparedStatementHandler
using the statement passed in.Begin creating aDELETE
operation for the givendomainType
.reactor.core.publisher.Mono<WriteResult>
delete
(Object entity, QueryOptions options) Delete the given entity applyingQueryOptions
and emit the entity if the delete statement was applied.reactor.core.publisher.Mono<Boolean>
Remove entities (rows)/columns from the table byQuery
.<T> reactor.core.publisher.Mono<T>
delete
(T entity) Delete the given entity and emit the entity if the delete statement was applied.reactor.core.publisher.Mono<Boolean>
deleteById
(Object id, Class<?> entityClass) Remove the given object from the table by id.reactor.core.publisher.Mono<ReactiveResultSet>
execute
(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Execute the given CassandraStatement
.reactor.core.publisher.Mono<Boolean>
Determine whether a row ofentityClass
with the givenid
exists.reactor.core.publisher.Mono<Boolean>
Determine whether the result forentityClass
Query
yields at least one row.Returns the underlyingCassandraConverter
.protected org.springframework.data.cassandra.core.EntityOperations
Returns theEntityOperations
used to perform data access operations on an entity inside a Cassandra data source.protected SpelAwareProxyProjectionFactory
Deprecated.Expose the underlyingReactiveCqlOperations
to allow CQL operations.protected StatementFactory
Returns theStatementFactory
used by this template to construct and run Cassandra CQL statements.Begin creating anINSERT
operation for givendomainType
.<T> reactor.core.publisher.Mono<T>
insert
(T entity) Insert the given entity and emit the entity if the insert was applied.<T> reactor.core.publisher.Mono<EntityWriteResult<T>>
insert
(T entity, InsertOptions options) Insert the given entity applyingWriteOptions
and emit the entity if the insert was applied.boolean
Returns whether this instance is configured to useprepared statements
.protected <T> reactor.core.publisher.Mono<T>
maybeCallBeforeConvert
(T object, com.datastax.oss.driver.api.core.CqlIdentifier tableName) protected <T> reactor.core.publisher.Mono<T>
maybeCallBeforeSave
(T object, com.datastax.oss.driver.api.core.CqlIdentifier tableName, com.datastax.oss.driver.api.core.cql.Statement<?> statement) protected <E extends CassandraMappingEvent<T>,
T>
voidmaybeEmitEvent
(Supplier<E> event) Begin creating aSELECT
operation for the givendomainType
.<T> reactor.core.publisher.Flux<T>
Execute aSELECT
query and convert the resulting items to a stream of entities.<T> reactor.core.publisher.Flux<T>
Execute aSELECT
query and convert the resulting items to a stream of entities.<T> reactor.core.publisher.Flux<T>
Execute aSELECT
query and convert the resulting items to a stream of entities.<T> reactor.core.publisher.Mono<T>
Execute aSELECT
query and convert the resulting item to an entity.<T> reactor.core.publisher.Mono<T>
Execute aSELECT
query and convert the resulting item to an entity.<T> reactor.core.publisher.Mono<T>
Execute aSELECT
query and convert the resulting item to an entity.<T> reactor.core.publisher.Mono<T>
selectOneById
(Object id, Class<T> entityClass) Execute the Select byid
for the givenentityClass
.void
setApplicationContext
(ApplicationContext applicationContext) void
setApplicationEventPublisher
(ApplicationEventPublisher applicationEventPublisher) void
setEntityCallbacks
(ReactiveEntityCallbacks entityCallbacks) ConfigureEntityCallbacks
to pre-/post-process entities during persistence operations.void
setEntityLifecycleEventsEnabled
(boolean enabled) Configure whether lifecycle events such asAfterLoadEvent
,BeforeSaveEvent
, etc. should be published or whether emission should be suppressed.void
setUsePreparedStatements
(boolean usePreparedStatements) Enable/disableprepared statements
usage.<T> reactor.core.publisher.Mono<Slice<T>>
Execute aSELECT
query with paging and convert the result set to aSlice
of entities.<T> reactor.core.publisher.Mono<Slice<T>>
Execute aSELECT
query with paging and convert the result set to aSlice
of entities.reactor.core.publisher.Mono<Void>
Execute aTRUNCATE
query to remove all entities of a given class.Begin creating anUPDATE
operation for the givendomainType
.reactor.core.publisher.Mono<Boolean>
Update the queried entities and return true if the update was applied.<T> reactor.core.publisher.Mono<T>
update
(T entity) Update the given entity and emit the entity if the update was applied.<T> reactor.core.publisher.Mono<EntityWriteResult<T>>
update
(T entity, UpdateOptions options) Update the given entity applyingWriteOptions
and emit 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.ReactiveCassandraOperations
batchOps, delete
-
Constructor Details
-
ReactiveCassandraTemplate
Creates an instance ofReactiveCassandraTemplate
initialized with the givenReactiveSession
and a defaultMappingCassandraConverter
.- Parameters:
session
-ReactiveSession
used to interact with Cassandra; must not be null.- See Also:
-
ReactiveCassandraTemplate
Create an instance ofCassandraTemplate
initialized with the givenReactiveSession
andCassandraConverter
.- Parameters:
session
-ReactiveSession
used to interact with Cassandra; must not be null.converter
-CassandraConverter
used to convert between Java and Cassandra types; must not be null.- See Also:
-
ReactiveCassandraTemplate
public ReactiveCassandraTemplate(ReactiveSessionFactory sessionFactory, CassandraConverter converter) Create an instance ofReactiveCassandraTemplate
initialized with the givenReactiveSessionFactory
andCassandraConverter
.- Parameters:
sessionFactory
-ReactiveSessionFactory
used to interact with Cassandra; must not be null.converter
-CassandraConverter
used to convert between Java and Cassandra types; must not be null.- See Also:
-
ReactiveCassandraTemplate
public ReactiveCassandraTemplate(ReactiveCqlOperations reactiveCqlOperations, CassandraConverter converter) Create an instance ofReactiveCassandraTemplate
initialized with the givenReactiveCqlOperations
andCassandraConverter
.- Parameters:
reactiveCqlOperations
-ReactiveCqlOperations
used to interact with Cassandra; must not be null.converter
-CassandraConverter
used to convert between Java and Cassandra types; must not be null.- See Also:
-
-
Method Details
-
batchOps
public ReactiveCassandraBatchOperations batchOps(com.datastax.oss.driver.api.core.cql.BatchType batchType) Description copied from interface:ReactiveCassandraOperations
Returns a newReactiveCassandraBatchOperations
. EachReactiveCassandraBatchOperations
instance can be executed only once, so you need to obtain newReactiveCassandraBatchOperations
instances for each batch.- Specified by:
batchOps
in interfaceReactiveCassandraOperations
- Parameters:
batchType
- must not be null.- Returns:
- a new
ReactiveCassandraBatchOperations
associated with the given entity class.
-
setApplicationEventPublisher
- Specified by:
setApplicationEventPublisher
in interfaceApplicationEventPublisherAware
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
setEntityCallbacks
ConfigureEntityCallbacks
to pre-/post-process entities during persistence operations.- Parameters:
entityCallbacks
-
-
setEntityLifecycleEventsEnabled
public void setEntityLifecycleEventsEnabled(boolean enabled) Configure whether lifecycle events such asAfterLoadEvent
,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:
-
getReactiveCqlOperations
Description copied from interface:ReactiveCassandraOperations
Expose the underlyingReactiveCqlOperations
to allow CQL operations.- Specified by:
getReactiveCqlOperations
in interfaceReactiveCassandraOperations
- Returns:
- the underlying
ReactiveCqlOperations
. - See Also:
-
getConverter
Description copied from interface:ReactiveCassandraOperations
Returns the underlyingCassandraConverter
.- Specified by:
getConverter
in interfaceReactiveCassandraOperations
- Returns:
- the underlying
CassandraConverter
.
-
isUsePreparedStatements
public boolean isUsePreparedStatements()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 aStatement
must be called withSimpleStatement
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) Enable/disableprepared statements
usage. 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 aStatement
must be called withSimpleStatement
instances to participate in statement preparation.- Parameters:
usePreparedStatements
- whether to use prepared statements.- Since:
- 3.2
-
getEntityOperations
protected org.springframework.data.cassandra.core.EntityOperations getEntityOperations()Returns theEntityOperations
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.since 3.4, useCassandraConverter.getProjectionFactory()
instead.Returns a reference to the configuredProjectionFactory
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:
-
getStatementFactory
Returns theStatementFactory
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
Description copied from interface:ReactiveCassandraOperations
Execute aSELECT
query and convert the resulting items to a stream of entities.- Specified by:
select
in interfaceReactiveCassandraOperations
- Parameters:
cql
- must not be null.entityClass
- The entity type must not be null.- Returns:
- the converted results
-
selectOne
Description copied from interface:ReactiveCassandraOperations
Execute aSELECT
query and convert the resulting item to an entity.- Specified by:
selectOne
in interfaceReactiveCassandraOperations
- 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()
-
execute
public reactor.core.publisher.Mono<ReactiveResultSet> execute(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws DataAccessException Description copied from interface:ReactiveCassandraOperations
Execute the given CassandraStatement
. Any errors that result from executing this command will be converted into Spring's DAO exception hierarchy.- Specified by:
execute
in interfaceReactiveCassandraOperations
- Parameters:
statement
- a CassandraStatement
, must not be null.- Returns:
- the
ReactiveResultSet
. - Throws:
DataAccessException
- if there is any problem issuing the execution.
-
select
public <T> reactor.core.publisher.Flux<T> select(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> entityClass) Description copied from interface:ReactiveCassandraOperations
Execute aSELECT
query and convert the resulting items to a stream of entities.- Specified by:
select
in interfaceReactiveCassandraOperations
- Parameters:
statement
- must not be null.entityClass
- The entity type must not be null.- Returns:
- the result objects returned by the action.
-
selectOne
public <T> reactor.core.publisher.Mono<T> selectOne(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> entityClass) Description copied from interface:ReactiveCassandraOperations
Execute aSELECT
query and convert the resulting item to an entity.- Specified by:
selectOne
in interfaceReactiveCassandraOperations
- 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()
-
slice
public <T> reactor.core.publisher.Mono<Slice<T>> slice(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> entityClass) Description copied from interface:ReactiveCassandraOperations
Execute aSELECT
query with paging and convert the result set to aSlice
of entities. A sliced query translates the effectivefetch size
to the page size.- Specified by:
slice
in interfaceReactiveCassandraOperations
- 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 emptySlice
.
-
select
public <T> reactor.core.publisher.Flux<T> select(Query query, Class<T> entityClass) throws DataAccessException Description copied from interface:ReactiveCassandraOperations
Execute aSELECT
query and convert the resulting items to a stream of entities.- Specified by:
select
in interfaceReactiveCassandraOperations
- 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.
-
selectOne
public <T> reactor.core.publisher.Mono<T> selectOne(Query query, Class<T> entityClass) throws DataAccessException Description copied from interface:ReactiveCassandraOperations
Execute aSELECT
query and convert the resulting item to an entity.- Specified by:
selectOne
in interfaceReactiveCassandraOperations
- 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.
-
slice
public <T> reactor.core.publisher.Mono<Slice<T>> slice(Query query, Class<T> entityClass) throws DataAccessException Description copied from interface:ReactiveCassandraOperations
Execute aSELECT
query with paging and convert the result set to aSlice
of entities.- Specified by:
slice
in interfaceReactiveCassandraOperations
- 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 emptySlice
. - Throws:
DataAccessException
- if there is any problem executing the query.- See Also:
-
update
public reactor.core.publisher.Mono<Boolean> update(Query query, Update update, Class<?> entityClass) throws DataAccessException Description copied from interface:ReactiveCassandraOperations
Update the queried entities and return true if the update was applied.- Specified by:
update
in interfaceReactiveCassandraOperations
- 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 reactor.core.publisher.Mono<Boolean> delete(Query query, Class<?> entityClass) throws DataAccessException Description copied from interface:ReactiveCassandraOperations
Remove entities (rows)/columns from the table byQuery
.- Specified by:
delete
in interfaceReactiveCassandraOperations
- 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
Description copied from interface:ReactiveCassandraOperations
Returns the number of rows for the given entity class.- Specified by:
count
in interfaceReactiveCassandraOperations
- Parameters:
entityClass
-type
of the entity; must not be null.- Returns:
- the number of existing entities.
-
count
public reactor.core.publisher.Mono<Long> count(Query query, Class<?> entityClass) throws DataAccessException Description copied from interface:ReactiveCassandraOperations
Returns the number of rows for the given entity class applyingQuery
. This overridden method allows users to further refine the selection criteria using aQuery
predicate to determine how many entities of the giventype
match the criteria.- Specified by:
count
in interfaceReactiveCassandraOperations
- Parameters:
query
- user-defined countQuery
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.
-
exists
Description copied from interface:ReactiveCassandraOperations
Determine whether a row ofentityClass
with the givenid
exists.- Specified by:
exists
in interfaceReactiveCassandraOperations
- Parameters:
id
- Id value. For single primary keys it's the plain value. For composite primary keys either, it's an instance of eitherPrimaryKeyClass
orMapId
. Must not be null.entityClass
-type
of the entity; must not be null.- Returns:
- true if the object exists.
-
exists
public reactor.core.publisher.Mono<Boolean> exists(Query query, Class<?> entityClass) throws DataAccessException Description copied from interface:ReactiveCassandraOperations
Determine whether the result forentityClass
Query
yields at least one row.- Specified by:
exists
in interfaceReactiveCassandraOperations
- Parameters:
query
- user-defined existsQuery
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.
-
selectOneById
Description copied from interface:ReactiveCassandraOperations
Execute the Select byid
for the givenentityClass
.- Specified by:
selectOneById
in interfaceReactiveCassandraOperations
- Parameters:
id
- the Id value. For single primary keys it's the plain value. For composite primary keys either thePrimaryKeyClass
orMapId
. Must not be null.entityClass
- The entity type must not be null.- Returns:
- the result object returned by the action or
Mono.empty()
-
insert
public <T> reactor.core.publisher.Mono<T> insert(T entity) Description copied from interface:ReactiveCassandraOperations
Insert the given entity and emit the entity if the insert was applied.- Specified by:
insert
in interfaceReactiveCassandraOperations
- Parameters:
entity
- The entity to insert, must not be null.- Returns:
- the inserted entity.
-
insert
public <T> reactor.core.publisher.Mono<EntityWriteResult<T>> insert(T entity, InsertOptions options) Description copied from interface:ReactiveCassandraOperations
Insert the given entity applyingWriteOptions
and emit the entity if the insert was applied.- Specified by:
insert
in interfaceReactiveCassandraOperations
- 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> reactor.core.publisher.Mono<T> update(T entity) Description copied from interface:ReactiveCassandraOperations
Update the given entity and emit the entity if the update was applied.- Specified by:
update
in interfaceReactiveCassandraOperations
- Parameters:
entity
- The entity to update, must not be null.- Returns:
- the updated entity.
-
update
public <T> reactor.core.publisher.Mono<EntityWriteResult<T>> update(T entity, UpdateOptions options) Description copied from interface:ReactiveCassandraOperations
Update the given entity applyingWriteOptions
and emit the entity if the update was applied.- Specified by:
update
in interfaceReactiveCassandraOperations
- 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> reactor.core.publisher.Mono<T> delete(T entity) Description copied from interface:ReactiveCassandraOperations
Delete the given entity and emit the entity if the delete statement was applied.- Specified by:
delete
in interfaceReactiveCassandraOperations
- Parameters:
entity
- must not be null.- Returns:
- the deleted entity.
-
delete
Description copied from interface:ReactiveCassandraOperations
Delete the given entity applyingQueryOptions
and emit the entity if the delete statement was applied.- Specified by:
delete
in interfaceReactiveCassandraOperations
- Parameters:
entity
- must not be null.options
- must not be null.- Returns:
- the
WriteResult
for this operation. - See Also:
-
deleteById
Description copied from interface:ReactiveCassandraOperations
Remove the given object from the table by id.- Specified by:
deleteById
in interfaceReactiveCassandraOperations
- Parameters:
id
- the Id value. For single primary keys it's the plain value. For composite primary keys either thePrimaryKeyClass
orMapId
. Must not be null.entityClass
- The entity type must not be null.- Returns:
- true if the deletion was applied.
-
truncate
Description copied from interface:ReactiveCassandraOperations
Execute aTRUNCATE
query to remove all entities of a given class.- Specified by:
truncate
in interfaceReactiveCassandraOperations
- Parameters:
entityClass
- The entity type must not be null.
-
delete
Description copied from interface:ReactiveDeleteOperation
Begin creating aDELETE
operation for the givendomainType
.- Specified by:
delete
in interfaceReactiveDeleteOperation
- Parameters:
domainType
-type
of domain object to delete; must not be null.- Returns:
- new instance of
ReactiveDeleteOperation.ReactiveDelete
. - See Also:
-
insert
Description copied from interface:ReactiveInsertOperation
Begin creating anINSERT
operation for givendomainType
.- Specified by:
insert
in interfaceReactiveInsertOperation
- Type Parameters:
T
-type
of the application domain object.- Parameters:
domainType
-type
of the domain object to insert; must not be null.- Returns:
- new instance of
ReactiveInsertOperation.ReactiveInsert
. - See Also:
-
query
Description copied from interface:ReactiveSelectOperation
Begin creating aSELECT
operation for the givendomainType
.- Specified by:
query
in interfaceReactiveSelectOperation
- Type Parameters:
T
-type
of the application domain object.- Parameters:
domainType
-type
of the domain object to query; must not be null.- Returns:
- new instance of
ReactiveSelectOperation.ReactiveSelect
. - See Also:
-
update
Description copied from interface:ReactiveUpdateOperation
Begin creating anUPDATE
operation for the givendomainType
.- Specified by:
update
in interfaceReactiveUpdateOperation
- Parameters:
domainType
-type
of domain object to update; must not be null.- Returns:
- new instance of
ReactiveUpdateOperation.ReactiveUpdate
. - See Also:
-
createPreparedStatementHandler
protected ReactiveCassandraTemplate.ReactivePreparedStatementHandler createPreparedStatementHandler(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Create a new statement-basedReactiveCassandraTemplate.ReactivePreparedStatementHandler
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
ReactiveCassandraTemplate.PreparedStatementHandler
to use. - Since:
- 3.3.3
-
maybeEmitEvent
-
maybeCallBeforeConvert
protected <T> reactor.core.publisher.Mono<T> maybeCallBeforeConvert(T object, com.datastax.oss.driver.api.core.CqlIdentifier tableName) -
maybeCallBeforeSave
protected <T> reactor.core.publisher.Mono<T> maybeCallBeforeSave(T object, com.datastax.oss.driver.api.core.CqlIdentifier tableName, com.datastax.oss.driver.api.core.cql.Statement<?> statement)
-
CassandraConverter.getProjectionFactory()
instead.