Class ReactiveCqlTemplate
- All Implemented Interfaces:
InitializingBean,ReactiveCqlOperations
ReactiveResultSets and
catching DriverException exceptions and translating them to the generic, more informative exception hierarchy
defined in the org.springframework.dao package.
Code using this class need only implement callback interfaces, giving them a clearly defined contract. The
PreparedStatementCreator callback interface creates a prepared statement given a Connection, providing CQL
and any necessary parameters. The ResultSetExtractor interface extracts values from a
ReactiveResultSet. See also PreparedStatementBinder and RowMapper for two popular alternative
callback interfaces.
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. 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.
Because this class is parameterizable by the callback interfaces and the
PersistenceExceptionTranslator interface, there should be no need to subclass
it.
All CQL operations performed by this class are logged at debug level, using "org.springframework.data.cassandra.core.cql.ReactiveCqlTemplate" as log category.
NOTE: An instance of this class is thread-safe once configured.
- Since:
- 2.0
- Author:
- Mark Paluch, Tomasz Lelek
- See Also:
-
Field Summary
Fields inherited from class org.springframework.data.cassandra.core.cql.ReactiveCassandraAccessor
logger -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a newReactiveCqlTemplate.ReactiveCqlTemplate(ReactiveSession reactiveSession) Construct a newReactiveCqlTemplate, given aReactiveSession.ReactiveCqlTemplate(ReactiveSessionFactory reactiveSessionFactory) Construct a newReactiveCqlTemplate, given aReactiveSessionFactoryto obtainReactiveSessions from. -
Method Summary
Modifier and TypeMethodDescriptionprotected com.datastax.oss.driver.api.core.cql.Statement<?>applyStatementSettings(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Prepare the given CQL Statement applying statement settings such as page size and consistency level.protected <T> reactor.core.publisher.Flux<T>createFlux(com.datastax.oss.driver.api.core.cql.Statement<?> statement, ReactiveStatementCallback<T> callback) Create a reusableFluxgiven aReactiveStatementCallbackwithout exception translation.protected <T> reactor.core.publisher.Flux<T>createFlux(ReactiveSessionCallback<T> callback) Create a reusableFluxgiven aReactiveSessionCallbackwithout exception translation.protected <T> reactor.core.publisher.Mono<T>createMono(com.datastax.oss.driver.api.core.cql.Statement<?> statement, ReactiveStatementCallback<T> callback) Create a reusableMonogiven aReactiveStatementCallbackwithout exception translation.reactor.core.publisher.Mono<Boolean>execute(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Issue a single CQL execute, typically a DDL statement, insert, update or delete statement.reactor.core.publisher.Mono<Boolean>Issue a single CQL execute, typically a DDL statement, insert, update or delete statement.reactor.core.publisher.Mono<Boolean>Issue a single CQL operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.reactor.core.publisher.Flux<Boolean>Issue a single CQL operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.reactor.core.publisher.Mono<Boolean>execute(String cql, PreparedStatementBinder psb) Issue an statement using aPreparedStatementBinderto set bind parameters, with given CQL.<T> reactor.core.publisher.Flux<T>execute(String cql, ReactivePreparedStatementCallback<T> action) Execute a CQL data access operation, implemented as callback action working on a CQLPreparedStatement.reactor.core.publisher.Flux<Boolean>Issue multiple CQL statements from a CQL statementPublisher.reactor.core.publisher.Mono<Boolean>Issue a single CQL execute operation (such as an insert, update or delete statement) using aReactivePreparedStatementCreatorto provide CQL and any required parameters.<T> reactor.core.publisher.Flux<T>execute(ReactivePreparedStatementCreator psc, ReactivePreparedStatementCallback<T> action) Execute a CQL data access operation, implemented as callback action working on a CQLPreparedStatement.<T> reactor.core.publisher.Flux<T>execute(ReactiveSessionCallback<T> action) Execute a CQL data access operation, implemented as callback action working on aReactiveSession.Create a new RowMapper for reading columns as key-value pairs.com.datastax.oss.driver.api.core.ConsistencyLevelintDeprecated.com.datastax.oss.driver.api.core.CqlIdentifierintcom.datastax.oss.driver.api.core.ConsistencyLevelprotected <T> RowMapper<T>getSingleColumnRowMapper(Class<T> requiredType) Create a new RowMapper for reading result objects from a single column.protected PreparedStatementBindernewArgPreparedStatementBinder(Object[] args) Create a new arg-based PreparedStatementSetter using the args passed in.protected ReactivePreparedStatementCreatorCreate a new CQL-basedReactivePreparedStatementCreatorusing the CQL passed in.<T> reactor.core.publisher.Flux<T>query(com.datastax.oss.driver.api.core.cql.Statement<?> statement, ReactiveResultSetExtractor<T> rse) Execute a query given static CQL, reading theReactiveResultSetwith aReactiveResultSetExtractor.<T> reactor.core.publisher.Flux<T>Execute a query given static CQL, mapping each row to a Java object via aRowMapper.<T> reactor.core.publisher.Flux<T>query(String cql, PreparedStatementBinder psb, ReactiveResultSetExtractor<T> rse) Query using a prepared statement, reading theReactiveResultSetwith aReactiveResultSetExtractor.<T> reactor.core.publisher.Flux<T>query(String cql, PreparedStatementBinder psb, RowMapper<T> rowMapper) Query given CQL to create a prepared statement from CQL and aPreparedStatementBinder implementation that knows how to bind values to the query, mapping each row to a Java object via aRowMapper.<T> reactor.core.publisher.Flux<T>query(String cql, ReactiveResultSetExtractor<T> resultSetExtractor) Execute a query given static CQL, reading theReactiveResultSetwith aReactiveResultSetExtractor.<T> reactor.core.publisher.Flux<T>query(String cql, ReactiveResultSetExtractor<T> rse, Object... args) Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, reading theReactiveResultSetwith aReactiveResultSetExtractor.<T> reactor.core.publisher.Flux<T>Execute a query given static CQL, mapping each row to a Java object via aRowMapper.<T> reactor.core.publisher.Flux<T>Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, mapping each row to a Java object via aRowMapper.<T> reactor.core.publisher.Flux<T>query(ReactivePreparedStatementCreator psc, PreparedStatementBinder preparedStatementBinder, ReactiveResultSetExtractor<T> rse) Query using a prepared statement, reading theReactiveResultSetwith aReactiveResultSetExtractor.<T> reactor.core.publisher.Flux<T>query(ReactivePreparedStatementCreator psc, PreparedStatementBinder psb, RowMapper<T> rowMapper) Query using a prepared statement and aPreparedStatementBinderimplementation that knows how to bind values to the query, mapping each row to a Java object via aRowMapper.<T> reactor.core.publisher.Flux<T>Query using a prepared statement, reading theReactiveResultSetwith aReactiveResultSetExtractor.<T> reactor.core.publisher.Flux<T>query(ReactivePreparedStatementCreator psc, RowMapper<T> rowMapper) Query using a prepared statement, mapping each row to a Java object via aRowMapper.queryForFlux(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Execute a query for a resultFlux, given static CQL.<T> reactor.core.publisher.Flux<T>queryForFlux(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> elementType) Execute a query for a resultFlux, given static CQL.queryForFlux(String cql) Execute a query for a resultFlux, given static CQL.<T> reactor.core.publisher.Flux<T>queryForFlux(String cql, Class<T> elementType) Execute a query for a resultFlux, given static CQL.<T> reactor.core.publisher.Flux<T>queryForFlux(String cql, Class<T> elementType, Object... args) Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a resultFlux.queryForFlux(String cql, Object... args) Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a resultFlux.queryForMap(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Execute a query for a result Map, given static CQL.queryForMap(String cql) Execute a query for a result Map, given static CQL.queryForMap(String cql, Object... args) Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a result Map.<T> reactor.core.publisher.Mono<T>queryForObject(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> requiredType) Execute a query for a result object, given static CQL.<T> reactor.core.publisher.Mono<T>queryForObject(com.datastax.oss.driver.api.core.cql.Statement<?> statement, RowMapper<T> rowMapper) Execute a query given static CQL, mapping a single result row to a Java object via aRowMapper.<T> reactor.core.publisher.Mono<T>queryForObject(String cql, Class<T> requiredType) Execute a query for a result object, given static CQL.<T> reactor.core.publisher.Mono<T>queryForObject(String cql, Class<T> requiredType, Object... args) Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a result object.<T> reactor.core.publisher.Mono<T>queryForObject(String cql, RowMapper<T> rowMapper) Execute a query given static CQL, mapping a single result row to a Java object via aRowMapper.<T> reactor.core.publisher.Mono<T>queryForObject(String cql, RowMapper<T> rowMapper, Object... args) Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, mapping a single result row to a Java object via aRowMapper.reactor.core.publisher.Mono<ReactiveResultSet>queryForResultSet(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Execute a query for a ResultSet, given static CQL.reactor.core.publisher.Mono<ReactiveResultSet>queryForResultSet(String cql) Execute a query for a ResultSet, given static CQL.reactor.core.publisher.Mono<ReactiveResultSet>queryForResultSet(String cql, Object... args) Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a ResultSet.reactor.core.publisher.Flux<com.datastax.oss.driver.api.core.cql.Row>queryForRows(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Execute a query for Rows, given static CQL.reactor.core.publisher.Flux<com.datastax.oss.driver.api.core.cql.Row>queryForRows(String cql) Execute a query for Rows, given static CQL.reactor.core.publisher.Flux<com.datastax.oss.driver.api.core.cql.Row>queryForRows(String cql, Object... args) Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting Rows.voidsetConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Set the consistency level for thisReactiveCqlTemplate.voidsetExecutionProfile(String profileName) Set the driver execution profile for this template.voidsetExecutionProfileResolver(ExecutionProfileResolver executionProfileResolver) Set theExecutionProfileResolverfor this template.voidsetFetchSize(int fetchSize) Deprecated.since 3.0, usesetPageSize(int)voidsetKeyspace(com.datastax.oss.driver.api.core.CqlIdentifier keyspace) Set thekeyspaceto be applied on statement-level for this template.voidsetPageSize(int fetchSize) Set the page size for this template.voidsetSerialConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Set the serial consistency level for this template.translateException(String task, String cql) Exception translationFunctionintended forMono.onErrorMap(Function)usage.translateException(String task, Supplier<String> cql) Exception translationFunctionintended forMono.onErrorMap(Function)usage.Methods inherited from class org.springframework.data.cassandra.core.cql.ReactiveCassandraAccessor
afterPropertiesSet, getExceptionTranslator, getSessionFactory, setExceptionTranslator, setSessionFactory, toCql, translate, translateExceptionIfPossible
-
Constructor Details
-
ReactiveCqlTemplate
public ReactiveCqlTemplate()Construct a newReactiveCqlTemplate. Note: TheReactiveSessionFactoryhas to be set before using the instance. -
ReactiveCqlTemplate
Construct a newReactiveCqlTemplate, given aReactiveSession.- Parameters:
reactiveSession- theReactiveSession, must not be null.
-
ReactiveCqlTemplate
Construct a newReactiveCqlTemplate, given aReactiveSessionFactoryto obtainReactiveSessions from.- Parameters:
reactiveSessionFactory- theReactiveSessionFactoryto obtainReactiveSessions from, must not be null.
-
-
Method Details
-
setConsistencyLevel
public void setConsistencyLevel(@Nullable com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Set the consistency level for thisReactiveCqlTemplate. Consistency level defines the number of nodes involved into query processing. Relaxed consistency level settings use fewer nodes but eventual consistency is more likely to occur while a higher consistency level involves more nodes to obtain results with a higher consistency guarantee.- See Also:
-
Statement.setConsistencyLevel(ConsistencyLevel)RetryPolicy
-
getConsistencyLevel
- Returns:
- the
ConsistencyLevelspecified for thisReactiveCqlTemplate.
-
setExecutionProfile
Set the driver execution profile for this template.- Since:
- 3.0
- See Also:
-
Statement.setExecutionProfileName(String)ExecutionProfileResolver
-
setExecutionProfileResolver
Set theExecutionProfileResolverfor this template.- Since:
- 3.0
- See Also:
-
DriverExecutionProfileExecutionProfileResolver
-
getExecutionProfileResolver
- Returns:
- the
ExecutionProfileResolverspecified for thisReactiveCqlTemplate. - Since:
- 3.0
-
setFetchSize
Deprecated.since 3.0, usesetPageSize(int)Set the fetch size for this template. This is important for processing large result sets: Setting this higher than the default value will increase processing speed at the cost of memory consumption; setting this lower can avoid transferring row data that will never be read by the application. Default is -1, indicating to use the CQL driver's default configuration (i.e. to not pass a specific fetch size setting on to the driver).- See Also:
-
StatementBuilder.setPageSize(int)
-
getFetchSize
Deprecated.since 3.0, usegetPageSize().- Returns:
- the fetch size specified for this template.
-
setKeyspace
public void setKeyspace(com.datastax.oss.driver.api.core.CqlIdentifier keyspace) Set thekeyspaceto be applied on statement-level for this template. If not set, the defaultCqlSessionkeyspace will be used.- Parameters:
keyspace- the keyspace to apply, must not be null.- Since:
- 3.1
- See Also:
-
SimpleStatement.setKeyspace(CqlIdentifier)BatchStatement.setKeyspace(CqlIdentifier)
-
getKeyspace
- Returns:
- the
keyspaceto be applied on statement-level for this template. - Since:
- 3.1
-
setPageSize
public void setPageSize(int fetchSize) Set the page size for this template. This is important for processing large result sets: Setting this higher than the default value will increase processing speed at the cost of memory consumption; setting this lower can avoid transferring row data that will never be read by the application. Default is -1, indicating to use the CQL driver's default configuration (i.e. to not pass a specific page size setting on to the driver).- See Also:
-
StatementBuilder.setPageSize(int)
-
getPageSize
public int getPageSize()- Returns:
- the page size specified for this template.
-
setSerialConsistencyLevel
public void setSerialConsistencyLevel(@Nullable com.datastax.oss.driver.api.core.ConsistencyLevel consistencyLevel) Set the serial consistency level for this template.- Since:
- 3.0
- See Also:
-
Statement.setSerialConsistencyLevel(ConsistencyLevel)ConsistencyLevel
-
getSerialConsistencyLevel
- Returns:
- the serial
ConsistencyLevelspecified for this template. - Since:
- 3.0
-
execute
public <T> reactor.core.publisher.Flux<T> execute(ReactiveSessionCallback<T> action) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a CQL data access operation, implemented as callback action working on aReactiveSession. This allows for implementing arbitrary data access operations, within Spring's managed CQL environment: that is, converting CQLDriverExceptions into Spring'sDataAccessExceptionhierarchy.The callback action can return a result object, for example a domain object or a collection of domain objects.
- Specified by:
executein interfaceReactiveCqlOperations- Parameters:
action- the callback object that specifies the action.- Returns:
- a result object returned by the action, or null.
- Throws:
DataAccessException- if there is any problem executing the query.
-
execute
Description copied from interface:ReactiveCqlOperationsIssue a single CQL execute, typically a DDL statement, insert, update or delete statement.- Specified by:
executein interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.- Returns:
- boolean value whether the statement was applied.
- Throws:
DataAccessException- if there is any problem executing the query.
-
query
public <T> reactor.core.publisher.Flux<T> query(String cql, ReactiveResultSetExtractor<T> resultSetExtractor) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query given static CQL, reading theReactiveResultSetwith aReactiveResultSetExtractor.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedquerymethod with null as argument array.- Specified by:
queryin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.resultSetExtractor- object that will extract all rows of results, must not be null.- Returns:
- an arbitrary result object, as returned by the ReactiveResultSetExtractor.
- Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
query
public <T> reactor.core.publisher.Flux<T> query(String cql, RowMapper<T> rowMapper) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query given static CQL, mapping each row to a Java object via aRowMapper.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedquerymethod with null as argument array.- Specified by:
queryin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.rowMapper- object that will map one object per row, must not be null.- Returns:
- the result
Flux, containing mapped objects. - Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
queryForObject
public <T> reactor.core.publisher.Mono<T> queryForObject(String cql, RowMapper<T> rowMapper) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query given static CQL, mapping a single result row to a Java object via aRowMapper.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedReactiveCqlOperations.queryForObject(String, RowMapper, Object...)method with null as argument array.- Specified by:
queryForObjectin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.rowMapper- object that will map one object per row, must not be null.- Returns:
- the single mapped object.
- Throws:
IncorrectResultSizeDataAccessException- if the query does not return exactly one row.DataAccessException- if there is any problem executing the query.- See Also:
-
queryForObject
public <T> reactor.core.publisher.Mono<T> queryForObject(String cql, Class<T> requiredType) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query for a result object, given static CQL.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedReactiveCqlOperations.queryForObject(String, Class, Object...)method with null as argument array.This method is useful for running static CQL with a known outcome. The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.
- Specified by:
queryForObjectin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.requiredType- the type that the result object is expected to match, must not be null.- Returns:
- the result object of the required type, or
Mono.empty()in case of CQL NULL. - Throws:
IncorrectResultSizeDataAccessException- if the query does not return exactly one row, or does not return exactly one column in that row.DataAccessException- if there is any problem executing the query.- See Also:
-
queryForMap
public reactor.core.publisher.Mono<Map<String,Object>> queryForMap(String cql) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query for a result Map, given static CQL.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedReactiveCqlOperations.queryForMap(String, Object...)method with null as argument array.The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key).
- Specified by:
queryForMapin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.- Returns:
- the result Map (one entry for each column, using the column name as the key), must not be null.
- Throws:
IncorrectResultSizeDataAccessException- if the query does not return exactly one row.DataAccessException- if there is any problem executing the query.- See Also:
-
queryForFlux
public <T> reactor.core.publisher.Flux<T> queryForFlux(String cql, Class<T> elementType) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query for a resultFlux, given static CQL.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedqueryForFluxmethod with null as argument array.The results will be mapped to a
Flux(one item for each row) of result objects, each of them matching the specified element type.- Specified by:
queryForFluxin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.elementType- the required type of element in the resultFlux(for example,Integer.class), must not be null.- Returns:
- a
Fluxof objects that match the specified element type. - Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
queryForFlux
public reactor.core.publisher.Flux<Map<String,Object>> queryForFlux(String cql) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query for a resultFlux, given static CQL.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedqueryForFluxmethod with null as argument array.The results will be mapped to a
Flux(one item for each row) ofMaps (one entry for each column using the column name as the key). Each item in theFluxwill be of the form returned by this interface's queryForMap() methods.- Specified by:
queryForFluxin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.- Returns:
- a
Fluxthat contains aMapper row. - Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
queryForResultSet
public reactor.core.publisher.Mono<ReactiveResultSet> queryForResultSet(String cql) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query for a ResultSet, given static CQL.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedqueryForResultSetmethod with null as argument array.The results will be mapped to an
ReactiveResultSet.- Specified by:
queryForResultSetin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.- Returns:
- a
ReactiveResultSetrepresentation. - Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
queryForRows
public reactor.core.publisher.Flux<com.datastax.oss.driver.api.core.cql.Row> queryForRows(String cql) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query for Rows, given static CQL.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedqueryForResultSetmethod with null as argument array.The results will be mapped to
Rows.- Specified by:
queryForRowsin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.- Returns:
- a Row representation.
- Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
execute
public reactor.core.publisher.Flux<Boolean> execute(org.reactivestreams.Publisher<String> statementPublisher) throws DataAccessException Description copied from interface:ReactiveCqlOperationsIssue multiple CQL statements from a CQL statementPublisher.- Specified by:
executein interfaceReactiveCqlOperations- Parameters:
statementPublisher- defining aPublisherof CQL statements that will be executed.- Returns:
- an array of the number of rows affected by each statement
- Throws:
DataAccessException- if there is any problem executing the batch.
-
execute
public reactor.core.publisher.Mono<Boolean> execute(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws DataAccessException Description copied from interface:ReactiveCqlOperationsIssue a single CQL execute, typically a DDL statement, insert, update or delete statement.- Specified by:
executein interfaceReactiveCqlOperations- Parameters:
statement- static CQLStatement, must not be null.- Returns:
- boolean value whether the statement was applied.
- Throws:
DataAccessException- if there is any problem executing the query.
-
query
public <T> reactor.core.publisher.Flux<T> query(com.datastax.oss.driver.api.core.cql.Statement<?> statement, ReactiveResultSetExtractor<T> rse) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query given static CQL, reading theReactiveResultSetwith aReactiveResultSetExtractor.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedquerymethod with null as argument array.- Specified by:
queryin interfaceReactiveCqlOperations- Parameters:
statement- static CQLStatement, must not be null.rse- object that will extract all rows of results, must not be null.- Returns:
- an arbitrary result object, as returned by the ReactiveResultSetExtractor.
- Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
query
public <T> reactor.core.publisher.Flux<T> query(com.datastax.oss.driver.api.core.cql.Statement<?> statement, RowMapper<T> rowMapper) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query given static CQL, mapping each row to a Java object via aRowMapper.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedquerymethod with null as argument array.- Specified by:
queryin interfaceReactiveCqlOperations- Parameters:
statement- static CQLStatement, must not be null.rowMapper- object that will map one object per row, must not be null.- Returns:
- the result
Flux, containing mapped objects. - Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
queryForObject
public <T> reactor.core.publisher.Mono<T> queryForObject(com.datastax.oss.driver.api.core.cql.Statement<?> statement, RowMapper<T> rowMapper) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query given static CQL, mapping a single result row to a Java object via aRowMapper.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedReactiveCqlOperations.queryForObject(String, RowMapper, Object...)method with null as argument array.- Specified by:
queryForObjectin interfaceReactiveCqlOperations- Parameters:
statement- static CQLStatement, must not be null.rowMapper- object that will map one object per row, must not be null.- Returns:
- the single mapped object.
- Throws:
IncorrectResultSizeDataAccessException- if the query does not return exactly one row.DataAccessException- if there is any problem executing the query.- See Also:
-
queryForObject
public <T> reactor.core.publisher.Mono<T> queryForObject(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> requiredType) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query for a result object, given static CQL.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedReactiveCqlOperations.queryForObject(String, Class, Object...)method with null as argument array.This method is useful for running static CQL with a known outcome. The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.
- Specified by:
queryForObjectin interfaceReactiveCqlOperations- Parameters:
statement- static CQLStatement, must not be null.requiredType- the type that the result object is expected to match, must not be null.- Returns:
- the result object of the required type, or
Mono.empty()in case of CQL NULL. - Throws:
IncorrectResultSizeDataAccessException- if the query does not return exactly one row, or does not return exactly one column in that row.DataAccessException- if there is any problem executing the query.- See Also:
-
queryForMap
public reactor.core.publisher.Mono<Map<String,Object>> queryForMap(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query for a result Map, given static CQL.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedReactiveCqlOperations.queryForMap(String, Object...)method with null as argument array.The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key).
- Specified by:
queryForMapin interfaceReactiveCqlOperations- Parameters:
statement- static CQLStatement, must not be null.- Returns:
- the result Map (one entry for each column, using the column name as the key), must not be null.
- Throws:
IncorrectResultSizeDataAccessException- if the query does not return exactly one row.DataAccessException- if there is any problem executing the query.- See Also:
-
queryForFlux
public <T> reactor.core.publisher.Flux<T> queryForFlux(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> elementType) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query for a resultFlux, given static CQL.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedqueryForFluxmethod with null as argument array.The results will be mapped to a
Flux(one item for each row) of result objects, each of them matching the specified element type.- Specified by:
queryForFluxin interfaceReactiveCqlOperations- Parameters:
statement- static CQLStatement, must not be null.elementType- the required type of element in the resultFlux(for example,Integer.class), must not be null.- Returns:
- a
Fluxof objects that match the specified element type. - Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
queryForFlux
public reactor.core.publisher.Flux<Map<String,Object>> queryForFlux(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query for a resultFlux, given static CQL.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedqueryForFluxmethod with null as argument array.The results will be mapped to a
Flux(one item for each row) ofMaps (one entry for each column using the column name as the key). Each item in theFluxwill be of the form returned by this interface's queryForMap() methods.- Specified by:
queryForFluxin interfaceReactiveCqlOperations- Parameters:
statement- static CQLStatement, must not be null.- Returns:
- a
Fluxthat contains aMapper row. - Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
queryForResultSet
public reactor.core.publisher.Mono<ReactiveResultSet> queryForResultSet(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query for a ResultSet, given static CQL.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedqueryForResultSetmethod with null as argument array.The results will be mapped to an
ReactiveResultSet.- Specified by:
queryForResultSetin interfaceReactiveCqlOperations- Parameters:
statement- static CQLStatement, must not be null.- Returns:
- a
ReactiveResultSetrepresentation. - Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
queryForRows
public reactor.core.publisher.Flux<com.datastax.oss.driver.api.core.cql.Row> queryForRows(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a query for Rows, given static CQL.Uses a CQL Statement, not a
PreparedStatement. If you want to execute a static query with aPreparedStatement, use the overloadedqueryForResultSetmethod with null as argument array.The results will be mapped to
Rows.- Specified by:
queryForRowsin interfaceReactiveCqlOperations- Parameters:
statement- static CQLStatement, must not be null.- Returns:
- a Row representation.
- Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
execute
public <T> reactor.core.publisher.Flux<T> execute(ReactivePreparedStatementCreator psc, ReactivePreparedStatementCallback<T> action) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a CQL data access operation, implemented as callback action working on a CQLPreparedStatement. This allows for implementing arbitrary data access operations on a singlePreparedStatement, within Spring's managed CQL environment: that is, participating in Spring-managed transactions and converting CQLDriverExceptions into Spring'sDataAccessExceptionhierarchy.The callback action can return a result object, for example a domain object or a collection of domain objects.
- Specified by:
executein interfaceReactiveCqlOperations- Parameters:
psc- object that can create aPreparedStatementgiven aReactiveSession, must not be null.action- callback object that specifies the action, must not be null.- Returns:
- a result object returned by the action, or null.
- Throws:
DataAccessException- if there is any problem executing the query.
-
execute
public <T> reactor.core.publisher.Flux<T> execute(String cql, ReactivePreparedStatementCallback<T> action) throws DataAccessException Description copied from interface:ReactiveCqlOperationsExecute a CQL data access operation, implemented as callback action working on a CQLPreparedStatement. This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed CQL environment: that is, participating in Spring-managed transactions and converting CQLDriverExceptions into Spring'sDataAccessExceptionhierarchy.The callback action can return a result object, for example a domain object or a collection of domain objects.
- Specified by:
executein interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.action- callback object that specifies the action, must not be null.- Returns:
- a result object returned by the action, or null
- Throws:
DataAccessException- if there is any problem executing the query.
-
query
public <T> reactor.core.publisher.Flux<T> query(ReactivePreparedStatementCreator psc, @Nullable PreparedStatementBinder preparedStatementBinder, ReactiveResultSetExtractor<T> rse) throws DataAccessException Query using a prepared statement, reading theReactiveResultSetwith aReactiveResultSetExtractor.- Specified by:
queryin interfaceReactiveCqlOperations- Parameters:
psc- object that can create aPreparedStatementgiven aReactiveSessionpreparedStatementBinder- object that knows how to set values on the prepared statement. If this is null, the CQL will be assumed to contain no bind parameters.rse- object that will extract results- Returns:
- an arbitrary result object, as returned by the
ReactiveResultSetExtractor - Throws:
DataAccessException- if there is any problem
-
query
public <T> reactor.core.publisher.Flux<T> query(ReactivePreparedStatementCreator psc, ReactiveResultSetExtractor<T> rse) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery using a prepared statement, reading theReactiveResultSetwith aReactiveResultSetExtractor.- Specified by:
queryin interfaceReactiveCqlOperations- Parameters:
psc- object that can create aPreparedStatementgiven aReactiveSession, must not be null.rse- object that will extract results, must not be null.- Returns:
- an arbitrary result object, as returned by the
ReactiveResultSetExtractor - Throws:
DataAccessException- if there is any problem executing the query.
-
query
public <T> reactor.core.publisher.Flux<T> query(String cql, @Nullable PreparedStatementBinder psb, ReactiveResultSetExtractor<T> rse) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery using a prepared statement, reading theReactiveResultSetwith aReactiveResultSetExtractor.- Specified by:
queryin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.psb- object that knows how to set values on the prepared statement. If this is null, the CQL will be assumed to contain no bind parameters. Even if there are no bind parameters, this object may be used to set fetch size and other performance options.rse- object that will extract results, must not be null.- Returns:
- an arbitrary result object, as returned by the
ReactiveResultSetExtractor. - Throws:
DataAccessException- if there is any problem executing the query.
-
query
public <T> reactor.core.publisher.Flux<T> query(String cql, ReactiveResultSetExtractor<T> rse, Object... args) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, reading theReactiveResultSetwith aReactiveResultSetExtractor.- Specified by:
queryin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.rse- object that will extract results, must not be null.args- arguments to bind to the query (leaving it to thePreparedStatementto guess the corresponding CQL type).- Returns:
- an arbitrary result object, as returned by the
ReactiveResultSetExtractor - Throws:
DataAccessException- if there is any problem executing the query.
-
query
public <T> reactor.core.publisher.Flux<T> query(ReactivePreparedStatementCreator psc, RowMapper<T> rowMapper) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery using a prepared statement, mapping each row to a Java object via aRowMapper.- Specified by:
queryin interfaceReactiveCqlOperations- Parameters:
psc- object that can create aPreparedStatementgiven aReactiveSession, must not be null.rowMapper- object that will map one object per row, must not be null.- Returns:
- the result
Flux, containing mapped objects. - Throws:
DataAccessException- if there is any problem executing the query.
-
query
public <T> reactor.core.publisher.Flux<T> query(String cql, @Nullable PreparedStatementBinder psb, RowMapper<T> rowMapper) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery given CQL to create a prepared statement from CQL and aPreparedStatementBinder implementation that knows how to bind values to the query, mapping each row to a Java object via aRowMapper.- Specified by:
queryin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.psb- object that knows how to set values on the prepared statement. If this is null, the CQL will be assumed to contain no bind parameters. Even if there are no bind parameters, this object may be used to set fetch size and other performance options.rowMapper- object that will map one object per row, must not be null.- Returns:
- the result
Flux, containing mapped objects. - Throws:
DataAccessException- if there is any problem executing the query.
-
query
public <T> reactor.core.publisher.Flux<T> query(ReactivePreparedStatementCreator psc, @Nullable PreparedStatementBinder psb, RowMapper<T> rowMapper) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery using a prepared statement and aPreparedStatementBinderimplementation that knows how to bind values to the query, mapping each row to a Java object via aRowMapper.- Specified by:
queryin interfaceReactiveCqlOperations- Parameters:
psc- object that can create aPreparedStatementgiven aCqlSession, must not be null.psb- object that knows how to set values on the prepared statement. If this is null, the CQL will be assumed to contain no bind parameters. Even if there are no bind parameters, this object may be used to set fetch size and other performance options.rowMapper- object that will map one object per row, must not be null.- Returns:
- the result
Flux, containing mapped objects. - Throws:
DataAccessException- if there is any problem executing the query.
-
query
public <T> reactor.core.publisher.Flux<T> query(String cql, RowMapper<T> rowMapper, Object... args) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, mapping each row to a Java object via aRowMapper.- Specified by:
queryin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.rowMapper- object that will map one object per rowargs- arguments to bind to the query (leaving it to thePreparedStatementto guess the corresponding CQL type)- Returns:
- the result
Flux, containing mapped objects - Throws:
DataAccessException- if there is any problem executing the query.
-
queryForObject
public <T> reactor.core.publisher.Mono<T> queryForObject(String cql, RowMapper<T> rowMapper, Object... args) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, mapping a single result row to a Java object via aRowMapper.- Specified by:
queryForObjectin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.rowMapper- object that will map one object per row, must not be null.args- arguments to bind to the query (leaving it to thePreparedStatementto guess the corresponding CQL type)- Returns:
- the single mapped object
- Throws:
IncorrectResultSizeDataAccessException- if the query does not return exactly one row.DataAccessException- if there is any problem executing the query.
-
queryForObject
public <T> reactor.core.publisher.Mono<T> queryForObject(String cql, Class<T> requiredType, Object... args) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a result object.The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.
- Specified by:
queryForObjectin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.requiredType- the type that the result object is expected to match, must not be null.args- arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding CQL type)- Returns:
- the result object of the required type, or
Mono.empty()in case of CQL NULL. - Throws:
IncorrectResultSizeDataAccessException- if the query does not return exactly one row, or does not return exactly one column in that row.DataAccessException- if there is any problem executing the query.- See Also:
-
queryForMap
public reactor.core.publisher.Mono<Map<String,Object>> queryForMap(String cql, Object... args) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a result Map. The queryForMap() methods defined by this interface are appropriate when you don't have a domain model. Otherwise, consider using one of the queryForObject() methods.The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key).
- Specified by:
queryForMapin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.args- arguments to bind to the query (leaving it to thePreparedStatementto guess the corresponding CQL type).- Returns:
- the result Map (one entry for each column, using the column name as the key).
- Throws:
IncorrectResultSizeDataAccessException- if the query does not return exactly one rowDataAccessException- if there is any problem executing the query.- See Also:
-
queryForFlux
public <T> reactor.core.publisher.Flux<T> queryForFlux(String cql, Class<T> elementType, Object... args) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a resultFlux.The results will be mapped to a
Flux(one item for each row) of result objects, each of them matching the specified element type.- Specified by:
queryForFluxin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.elementType- the required type of element in the resultFlux(for example,Integer.class), must not be null.args- arguments to bind to the query (leaving it to thePreparedStatementto guess the corresponding CQL type).- Returns:
- a
Fluxof objects that match the specified element type. - Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
queryForFlux
public reactor.core.publisher.Flux<Map<String,Object>> queryForFlux(String cql, Object... args) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a resultFlux.The results will be mapped to a
Flux(one item for each row) ofMaps (one entry for each column, using the column name as the key). Each item in theFluxwill be of the form returned by this interface's queryForMap() methods.- Specified by:
queryForFluxin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.args- arguments to bind to the query (leaving it to thePreparedStatementto guess the corresponding CQL type).- Returns:
- a
Fluxthat contains aMapper row - Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
queryForResultSet
public reactor.core.publisher.Mono<ReactiveResultSet> queryForResultSet(String cql, Object... args) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting a ResultSet.The results will be mapped to an
ReactiveResultSet.- Specified by:
queryForResultSetin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.args- arguments to bind to the query (leaving it to thePreparedStatementto guess the corresponding CQL type).- Returns:
- a
ReactiveResultSetrepresentation. - Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
queryForRows
public reactor.core.publisher.Flux<com.datastax.oss.driver.api.core.cql.Row> queryForRows(String cql, Object... args) throws DataAccessException Description copied from interface:ReactiveCqlOperationsQuery given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, expecting Rows.The results will be mapped to
Rows.- Specified by:
queryForRowsin interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.args- arguments to bind to the query (leaving it to thePreparedStatementto guess the corresponding CQL type).- Returns:
- a
Rowrepresentation. - Throws:
DataAccessException- if there is any problem executing the query.- See Also:
-
execute
public reactor.core.publisher.Mono<Boolean> execute(ReactivePreparedStatementCreator psc) throws DataAccessException Description copied from interface:ReactiveCqlOperationsIssue a single CQL execute operation (such as an insert, update or delete statement) using aReactivePreparedStatementCreatorto provide CQL and any required parameters.- Specified by:
executein interfaceReactiveCqlOperations- Parameters:
psc- object that provides CQL and any necessary parameters, must not be null.- Returns:
- boolean value whether the statement was applied.
- Throws:
DataAccessException- if there is any problem issuing the execution.
-
execute
public reactor.core.publisher.Mono<Boolean> execute(String cql, @Nullable PreparedStatementBinder psb) throws DataAccessException Description copied from interface:ReactiveCqlOperationsIssue an statement using aPreparedStatementBinderto set bind parameters, with given CQL. Simpler than using aReactivePreparedStatementCreatoras this method will create thePreparedStatement: ThePreparedStatementBinderjust needs to set parameters.- Specified by:
executein interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.psb- object that knows how to set values on the prepared statement. If this is null, the CQL will be assumed to contain no bind parameters. Even if there are no bind parameters, this object may be used to set fetch size and other performance options.- Returns:
- boolean value whether the statement was applied.
- Throws:
DataAccessException- if there is any problem executing the query.
-
execute
public reactor.core.publisher.Mono<Boolean> execute(String cql, Object... args) throws DataAccessException Description copied from interface:ReactiveCqlOperationsIssue a single CQL operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.- Specified by:
executein interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute, must not be empty or null.args- arguments to bind to the query (leaving it to thePreparedStatementto guess the corresponding CQL type).- Returns:
- boolean value whether the statement was applied.
- Throws:
DataAccessException- if there is any problem executing the query.
-
execute
public reactor.core.publisher.Flux<Boolean> execute(String cql, org.reactivestreams.Publisher<Object[]> args) throws DataAccessException Description copied from interface:ReactiveCqlOperationsIssue a single CQL operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.- Specified by:
executein interfaceReactiveCqlOperations- Parameters:
cql- static CQL to execute containing bind parameters, must not be empty or null.args- arguments to bind to the query (leaving it to thePreparedStatementto guess the corresponding CQL type).- Returns:
- boolean value whether the statement was applied.
- Throws:
DataAccessException- if there is any problem executing the query.
-
newReactivePreparedStatementCreator
Create a new CQL-basedReactivePreparedStatementCreatorusing the CQL passed in. By default, we'll create anReactiveCqlTemplate.SimpleReactivePreparedStatementCreator. This method allows for the creation to be overridden by subclasses.- Parameters:
cql- static CQL to execute, must not be empty or null.- Returns:
- the new
ReactivePreparedStatementCreatorto use - Since:
- 2.0.8
-
createFlux
protected <T> reactor.core.publisher.Flux<T> createFlux(com.datastax.oss.driver.api.core.cql.Statement<?> statement, ReactiveStatementCallback<T> callback) Create a reusableFluxgiven aReactiveStatementCallbackwithout exception translation.- Parameters:
callback- must not be null.- Returns:
- a reusable
Fluxwrapping theReactiveStatementCallback.
-
createMono
protected <T> reactor.core.publisher.Mono<T> createMono(com.datastax.oss.driver.api.core.cql.Statement<?> statement, ReactiveStatementCallback<T> callback) Create a reusableMonogiven aReactiveStatementCallbackwithout exception translation.- Parameters:
callback- must not be null.- Returns:
- a reusable
Monowrapping theReactiveStatementCallback.
-
createFlux
Create a reusableFluxgiven aReactiveSessionCallbackwithout exception translation.- Parameters:
callback- must not be null.- Returns:
- a reusable
Fluxwrapping theReactiveSessionCallback.
-
translateException
Exception translationFunctionintended forMono.onErrorMap(Function)usage.- Parameters:
task- readable text describing the task being attemptedcql- CQL query or update that caused the problem (may be null)- Returns:
- the exception translation
Function - See Also:
-
translateException
Exception translationFunctionintended forMono.onErrorMap(Function)usage.- Parameters:
task- readable text describing the task being attemptedcql- supplier of CQL query or update that caused the problem (may be null)- Returns:
- the exception translation
Function - Since:
- 3.3.3
- See Also:
-
getColumnMapRowMapper
Create a new RowMapper for reading columns as key-value pairs.- Returns:
- the RowMapper to use
- See Also:
-
getSingleColumnRowMapper
Create a new RowMapper for reading result objects from a single column.- Parameters:
requiredType- the type that each result object is expected to match- Returns:
- the RowMapper to use
- See Also:
-
applyStatementSettings
protected com.datastax.oss.driver.api.core.cql.Statement<?> applyStatementSettings(com.datastax.oss.driver.api.core.cql.Statement<?> statement) Prepare the given CQL Statement applying statement settings such as page size and consistency level.- Parameters:
statement- the CQL Statement to prepare- See Also:
-
newArgPreparedStatementBinder
Create a new arg-based PreparedStatementSetter using the args passed in.By default, we'll create an
ArgumentPreparedStatementBinder. This method allows for the creation to be overridden by subclasses.- Parameters:
args- object array with arguments- Returns:
- the new
PreparedStatementBinderto use
-
getPageSize().