public interface AsyncCqlOperations
CqlTemplate
, but returns result handles or accepts callbacks as opposed to concrete results. Implemented by
AsyncCqlTemplate
. Not often used directly, but a useful option to enhance testability, as it can easily be
mocked or stubbed.AsyncCqlTemplate
,
CqlOperations
Modifier and Type | Method and Description |
---|---|
ListenableFuture<Boolean> |
execute(AsyncPreparedStatementCreator preparedStatementCreator)
Issue a single CQL execute operation (such as an insert, update or delete statement) using a
AsyncPreparedStatementCreator to provide CQL and any required parameters. |
<T> ListenableFuture<T> |
execute(AsyncPreparedStatementCreator preparedStatementCreator,
PreparedStatementCallback<T> action)
Execute a CQL data access operation, implemented as callback action working on a CQL
PreparedStatement . |
<T> ListenableFuture<T> |
execute(AsyncSessionCallback<T> action)
Execute a CQL data access operation, implemented as callback action working on a
CqlSession . |
ListenableFuture<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.
|
ListenableFuture<Boolean> |
execute(String cql)
Issue a single CQL execute, typically a DDL statement, insert, update or delete statement.
|
ListenableFuture<Boolean> |
execute(String cql,
Object... args)
Issue a single CQL operation (such as an insert, update or delete statement) via a prepared statement, binding the
given arguments.
|
ListenableFuture<Boolean> |
execute(String cql,
PreparedStatementBinder psb)
Issue an statement using a
PreparedStatementBinder to set bind parameters, with given CQL. |
<T> ListenableFuture<T> |
execute(String cql,
PreparedStatementCallback<T> action)
Execute a CQL data access operation, implemented as callback action working on a CQL
PreparedStatement . |
<T> ListenableFuture<T> |
query(AsyncPreparedStatementCreator preparedStatementCreator,
AsyncResultSetExtractor<T> resultSetExtractor)
Query using a prepared statement, reading the
ResultSet with a AsyncResultSetExtractor . |
<T> ListenableFuture<T> |
query(AsyncPreparedStatementCreator preparedStatementCreator,
PreparedStatementBinder psb,
AsyncResultSetExtractor<T> resultSetExtractor)
Query using a prepared statement and a
PreparedStatementBinder implementation that knows how to bind values
to the query, reading the ResultSet with a AsyncResultSetExtractor . |
ListenableFuture<Void> |
query(AsyncPreparedStatementCreator preparedStatementCreator,
PreparedStatementBinder psb,
RowCallbackHandler rowCallbackHandler)
Query using a prepared statement and a
PreparedStatementBinder implementation that knows how to bind values
to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler . |
<T> ListenableFuture<List<T>> |
query(AsyncPreparedStatementCreator preparedStatementCreator,
PreparedStatementBinder psb,
RowMapper<T> rowMapper)
Query using a prepared statement and a
PreparedStatementBinder implementation that knows how to bind values
to the query, mapping each row to a Java object via a RowMapper . |
ListenableFuture<Void> |
query(AsyncPreparedStatementCreator preparedStatementCreator,
RowCallbackHandler rowCallbackHandler)
Query using a prepared statement, reading the
ResultSet on a per-row basis with a
RowCallbackHandler . |
<T> ListenableFuture<List<T>> |
query(AsyncPreparedStatementCreator preparedStatementCreator,
RowMapper<T> rowMapper)
Query using a prepared statement, mapping each row to a Java object via a
RowMapper . |
<T> ListenableFuture<T> |
query(com.datastax.oss.driver.api.core.cql.Statement<?> statement,
AsyncResultSetExtractor<T> resultSetExtractor)
Execute a query given static CQL, reading the
ResultSet with a AsyncResultSetExtractor . |
ListenableFuture<Void> |
query(com.datastax.oss.driver.api.core.cql.Statement<?> statement,
RowCallbackHandler rowCallbackHandler)
Execute a query given static CQL, reading the
ResultSet on a per-row basis with a
RowCallbackHandler . |
<T> ListenableFuture<List<T>> |
query(com.datastax.oss.driver.api.core.cql.Statement<?> statement,
RowMapper<T> rowMapper)
Execute a query given static CQL, mapping each row to a Java object via a
RowMapper . |
<T> ListenableFuture<T> |
query(String cql,
AsyncResultSetExtractor<T> resultSetExtractor)
Execute a query given static CQL, reading the
ResultSet with a AsyncResultSetExtractor . |
<T> ListenableFuture<T> |
query(String cql,
AsyncResultSetExtractor<T> resultSetExtractor,
Object... args)
Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, reading the
ResultSet with a AsyncResultSetExtractor . |
<T> ListenableFuture<T> |
query(String cql,
PreparedStatementBinder psb,
AsyncResultSetExtractor<T> resultSetExtractor)
Query using a prepared statement, reading the
ResultSet with a AsyncResultSetExtractor . |
ListenableFuture<Void> |
query(String cql,
PreparedStatementBinder psb,
RowCallbackHandler rowCallbackHandler)
Query given CQL to create a prepared statement from CQL and a
PreparedStatementBinder implementation that
knows how to bind values to the query, reading the ResultSet on a per-row basis with a
RowCallbackHandler . |
<T> ListenableFuture<List<T>> |
query(String cql,
PreparedStatementBinder psb,
RowMapper<T> rowMapper)
Query given CQL to create a prepared statement from CQL and a
PreparedStatementBinder implementation that
knows how to bind values to the query, mapping each row to a Java object via a RowMapper . |
ListenableFuture<Void> |
query(String cql,
RowCallbackHandler rowCallbackHandler)
Execute a query given static CQL, reading the
ResultSet on a per-row basis with a
RowCallbackHandler . |
ListenableFuture<Void> |
query(String cql,
RowCallbackHandler rowCallbackHandler,
Object... args)
Query given CQL to create a prepared statement from CQL and a list of arguments to bind to the query, reading the
ResultSet on a per-row basis with a RowCallbackHandler . |
<T> ListenableFuture<List<T>> |
query(String cql,
RowMapper<T> rowMapper)
Execute a query given static CQL, mapping each row to a Java object via a
RowMapper . |
<T> ListenableFuture<List<T>> |
query(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 each
row to a Java object via a
RowMapper . |
ListenableFuture<List<Map<String,Object>>> |
queryForList(com.datastax.oss.driver.api.core.cql.Statement<?> statement)
Execute a query for a result
List , given static CQL. |
<T> ListenableFuture<List<T>> |
queryForList(com.datastax.oss.driver.api.core.cql.Statement<?> statement,
Class<T> elementType)
Execute a query for a result
List , given static CQL. |
ListenableFuture<List<Map<String,Object>>> |
queryForList(String cql)
Execute a query for a result
List , given static CQL. |
<T> ListenableFuture<List<T>> |
queryForList(String cql,
Class<T> elementType)
Execute a query for a result
List , given static CQL. |
<T> ListenableFuture<List<T>> |
queryForList(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
result
List . |
ListenableFuture<List<Map<String,Object>>> |
queryForList(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
List . |
ListenableFuture<Map<String,Object>> |
queryForMap(com.datastax.oss.driver.api.core.cql.Statement<?> statement)
Execute a query for a result Map, given static CQL.
|
ListenableFuture<Map<String,Object>> |
queryForMap(String cql)
Execute a query for a result Map, given static CQL.
|
ListenableFuture<Map<String,Object>> |
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> ListenableFuture<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> ListenableFuture<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 a
RowMapper . |
<T> ListenableFuture<T> |
queryForObject(String cql,
Class<T> requiredType)
Execute a query for a result object, given static CQL.
|
<T> ListenableFuture<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> ListenableFuture<T> |
queryForObject(String cql,
RowMapper<T> rowMapper)
Execute a query given static CQL, mapping a single result row to a Java object via a
RowMapper . |
<T> ListenableFuture<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 a
RowMapper . |
ListenableFuture<com.datastax.oss.driver.api.core.cql.AsyncResultSet> |
queryForResultSet(com.datastax.oss.driver.api.core.cql.Statement<?> statement)
Execute a query for a ResultSet, given static CQL.
|
ListenableFuture<com.datastax.oss.driver.api.core.cql.AsyncResultSet> |
queryForResultSet(String cql)
Execute a query for a ResultSet, given static CQL.
|
ListenableFuture<com.datastax.oss.driver.api.core.cql.AsyncResultSet> |
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.
|
<T> ListenableFuture<T> execute(AsyncSessionCallback<T> action) throws DataAccessException
CqlSession
. This allows for implementing arbitrary data access operations,
within Spring's managed CQL environment: that is, converting CQL
DriverException
s into Spring's DataAccessException
hierarchy.
The callback action can return a result object, for example a domain object or a collection of domain objects.
action
- the callback object that specifies the action.DataAccessException
- if there is any problem executing the query.ListenableFuture<Boolean> execute(String cql) throws DataAccessException
cql
- static CQL to execute, must not be null or empty.DataAccessException
- if there is any problem executing the query.ListenableFuture<Boolean> execute(String cql, Object... args) throws DataAccessException
cql
- static CQL to execute, must not be null or empty.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).DataAccessException
- if there is any problem executing the query.ListenableFuture<Boolean> execute(String cql, @Nullable PreparedStatementBinder psb) throws DataAccessException
PreparedStatementBinder
to set bind parameters, with given CQL. Simpler than
using a AsyncPreparedStatementCreator
as this method will create the PreparedStatement
: The
PreparedStatementBinder
just needs to set parameters.cql
- static CQL to execute, must not be null or empty.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.DataAccessException
- if there is any problem executing the query.<T> ListenableFuture<T> execute(String cql, PreparedStatementCallback<T> action) throws DataAccessException
PreparedStatement
.
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 CQL
DriverException
s into Spring's DataAccessException
hierarchy.
The callback action can return a result object, for example a domain object or a collection of domain objects.
cql
- static CQL to execute, must not be null or empty.action
- callback object that specifies the action, must not be null.DataAccessException
- if there is any problem executing the query.<T> ListenableFuture<T> query(String cql, AsyncResultSetExtractor<T> resultSetExtractor) throws DataAccessException
ResultSet
with a AsyncResultSetExtractor
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded query
method with null as argument array.
cql
- static CQL to execute, must not be null or empty.resultSetExtractor
- object that will extract all rows of results, must not be null.DataAccessException
- if there is any problem executing the query.query(String, AsyncResultSetExtractor, Object...)
ListenableFuture<Void> query(String cql, RowCallbackHandler rowCallbackHandler) throws DataAccessException
ResultSet
on a per-row basis with a
RowCallbackHandler
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded query
method with null as argument array.
cql
- static CQL to execute, must not be null or empty.rowCallbackHandler
- object that will extract results, one row at a time, must not be null.DataAccessException
- if there is any problem executing the query.query(String, RowCallbackHandler, Object[])
<T> ListenableFuture<List<T>> query(String cql, RowMapper<T> rowMapper) throws DataAccessException
RowMapper
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded query
method with null as argument array.
cql
- static CQL to execute, must not be null or empty.rowMapper
- object that will map one object per row, must not be null.List
, containing mapped objects.DataAccessException
- if there is any problem executing the query.query(String, RowMapper, Object[])
<T> ListenableFuture<T> query(String cql, AsyncResultSetExtractor<T> resultSetExtractor, Object... args) throws DataAccessException
ResultSet
with a AsyncResultSetExtractor
.cql
- static CQL to execute, must not be null or empty.resultSetExtractor
- object that will extract results, must not be null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).AsyncResultSetExtractor
DataAccessException
- if there is any problem executing the query.ListenableFuture<Void> query(String cql, RowCallbackHandler rowCallbackHandler, Object... args) throws DataAccessException
ResultSet
on a per-row basis with a RowCallbackHandler
.cql
- static CQL to execute, must not be null or empty.rowCallbackHandler
- object that will extract results, one row at a time, must not be null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type)DataAccessException
- if there is any problem executing the query.<T> ListenableFuture<List<T>> query(String cql, RowMapper<T> rowMapper, Object... args) throws DataAccessException
RowMapper
.cql
- static CQL to execute, must not be null or empty.rowMapper
- object that will map one object per rowargs
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type)List
, containing mapped objectsDataAccessException
- if there is any problem executing the query.<T> ListenableFuture<T> query(String cql, @Nullable PreparedStatementBinder psb, AsyncResultSetExtractor<T> resultSetExtractor) throws DataAccessException
ResultSet
with a AsyncResultSetExtractor
.cql
- static CQL to execute, must not be null or empty.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.resultSetExtractor
- object that will extract results, must not be null.AsyncResultSetExtractor
.DataAccessException
- if there is any problem executing the query.ListenableFuture<Void> query(String cql, @Nullable PreparedStatementBinder psb, RowCallbackHandler rowCallbackHandler) throws DataAccessException
PreparedStatementBinder
implementation that
knows how to bind values to the query, reading the ResultSet
on a per-row basis with a
RowCallbackHandler
.cql
- static CQL to execute, must not be null or empty.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.rowCallbackHandler
- object that will extract results, one row at a time, must not be null.DataAccessException
- if there is any problem executing the query.<T> ListenableFuture<List<T>> query(String cql, @Nullable PreparedStatementBinder psb, RowMapper<T> rowMapper) throws DataAccessException
PreparedStatementBinder
implementation that
knows how to bind values to the query, mapping each row to a Java object via a RowMapper
.cql
- static CQL to execute, must not be null or empty.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.List
, containing mapped objects.DataAccessException
- if there is any problem executing the query.ListenableFuture<List<Map<String,Object>>> queryForList(String cql) throws DataAccessException
List
, given static CQL.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForList
method with null as argument array.
The results will be mapped to a List
(one item for each row) of Map
s (one entry for each column
using the column name as the key). Each item in the List
will be of the form returned by this interface's
queryForMap() methods.
cql
- static CQL to execute, must not be null or empty.List
that contains a Map
per row.DataAccessException
- if there is any problem executing the query.queryForList(String, Object[])
ListenableFuture<List<Map<String,Object>>> queryForList(String cql, Object... args) throws DataAccessException
List
.
The results will be mapped to a List
(one item for each row) of Map
s (one entry for each column,
using the column name as the key). Each item in the List
will be of the form returned by this interface's
queryForMap() methods.
cql
- static CQL to execute, must not be null or empty.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).List
that contains a Map
per rowDataAccessException
- if there is any problem executing the query.queryForList(String)
<T> ListenableFuture<List<T>> queryForList(String cql, Class<T> elementType) throws DataAccessException
List
, given static CQL.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForList
method with null as argument array.
The results will be mapped to a List
(one item for each row) of result objects, each of them matching the
specified element type.
cql
- static CQL to execute, must not be null or empty.elementType
- the required type of element in the result List
(for example, Integer.class
),
must not be null.List
of objects that match the specified element type.DataAccessException
- if there is any problem executing the query.queryForList(String, Class, Object[])
,
SingleColumnRowMapper
<T> ListenableFuture<List<T>> queryForList(String cql, Class<T> elementType, Object... args) throws DataAccessException
List
.
The results will be mapped to a List
(one item for each row) of result objects, each of them matching the
specified element type.
cql
- static CQL to execute, must not be null or empty.elementType
- the required type of element in the result List
(for example, Integer.class
),
must not be null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).List
of objects that match the specified element type.DataAccessException
- if there is any problem executing the query.queryForList(String, Class)
,
SingleColumnRowMapper
ListenableFuture<Map<String,Object>> queryForMap(String cql) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded 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).
cql
- static CQL to execute, must not be null or empty.IncorrectResultSizeDataAccessException
- if the query does not return exactly one row.DataAccessException
- if there is any problem executing the query.queryForMap(String, Object[])
,
ColumnMapRowMapper
ListenableFuture<Map<String,Object>> queryForMap(String cql, Object... args) throws DataAccessException
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).
cql
- static CQL to execute, must not be null or empty.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).IncorrectResultSizeDataAccessException
- if the query does not return exactly one rowDataAccessException
- if there is any problem executing the query.queryForMap(String)
,
ColumnMapRowMapper
<T> ListenableFuture<T> queryForObject(String cql, Class<T> requiredType) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded 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.
cql
- static CQL to execute, must not be null or empty.requiredType
- the type that the result object is expected to match, must not be null.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.queryForObject(String, Class, Object[])
<T> ListenableFuture<T> queryForObject(String cql, Class<T> requiredType, Object... args) throws DataAccessException
The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.
cql
- static CQL to execute, must not be null or empty.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)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.queryForObject(String, Class)
<T> ListenableFuture<T> queryForObject(String cql, RowMapper<T> rowMapper) throws DataAccessException
RowMapper
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForObject(String, RowMapper, Object...)
method with
null as argument array.
cql
- static CQL to execute, must not be null or empty.rowMapper
- object that will map one object per row, must not be null.IncorrectResultSizeDataAccessException
- if the query does not return exactly one row.DataAccessException
- if there is any problem executing the query.queryForObject(String, RowMapper, Object[])
<T> ListenableFuture<T> queryForObject(String cql, RowMapper<T> rowMapper, Object... args) throws DataAccessException
RowMapper
.cql
- static CQL to execute, must not be null or empty.rowMapper
- object that will map one object per row, must not be null.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type)IncorrectResultSizeDataAccessException
- if the query does not return exactly one row.DataAccessException
- if there is any problem executing the query.ListenableFuture<com.datastax.oss.driver.api.core.cql.AsyncResultSet> queryForResultSet(String cql) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForResultSet
method with null as argument
array.
The results will be mapped to an ResultSet
.
cql
- static CQL to execute, must not be null or empty.ResultSet
representation.DataAccessException
- if there is any problem executing the query.queryForResultSet(String, Object[])
ListenableFuture<com.datastax.oss.driver.api.core.cql.AsyncResultSet> queryForResultSet(String cql, Object... args) throws DataAccessException
The results will be mapped to an ResultSet
.
cql
- static CQL to execute, must not be null or empty.args
- arguments to bind to the query (leaving it to the PreparedStatement
to guess the corresponding
CQL type).ResultSet
representation.DataAccessException
- if there is any problem executing the query.queryForResultSet(String)
ListenableFuture<Boolean> execute(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws DataAccessException
statement
- static CQL Statement
, must not be null.DataAccessException
- if there is any problem executing the query.<T> ListenableFuture<T> query(com.datastax.oss.driver.api.core.cql.Statement<?> statement, AsyncResultSetExtractor<T> resultSetExtractor) throws DataAccessException
ResultSet
with a AsyncResultSetExtractor
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded query
method with null as argument array.
statement
- static CQL Statement
, must not be null.resultSetExtractor
- object that will extract all rows of results, must not be null.DataAccessException
- if there is any problem executing the query.query(String, AsyncResultSetExtractor, Object...)
ListenableFuture<Void> query(com.datastax.oss.driver.api.core.cql.Statement<?> statement, RowCallbackHandler rowCallbackHandler) throws DataAccessException
ResultSet
on a per-row basis with a
RowCallbackHandler
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded query
method with null as argument array.
statement
- static CQL Statement
, must not be null.rowCallbackHandler
- object that will extract results, one row at a time, must not be null.DataAccessException
- if there is any problem executing the query.query(String, RowCallbackHandler, Object[])
<T> ListenableFuture<List<T>> query(com.datastax.oss.driver.api.core.cql.Statement<?> statement, RowMapper<T> rowMapper) throws DataAccessException
RowMapper
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded query
method with null as argument array.
statement
- static CQL Statement
, must not be null.rowMapper
- object that will map one object per row, must not be null.List
, containing mapped objects.DataAccessException
- if there is any problem executing the query.query(String, RowMapper, Object[])
ListenableFuture<List<Map<String,Object>>> queryForList(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws DataAccessException
List
, given static CQL.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForList
method with null as argument array.
The results will be mapped to a List
(one item for each row) of Map
s (one entry for each column
using the column name as the key). Each item in the List
will be of the form returned by this interface's
queryForMap() methods.
statement
- static CQL Statement
to execute, must not be null or empty.List
that contains a Map
per row.DataAccessException
- if there is any problem executing the query.queryForList(String, Object[])
<T> ListenableFuture<List<T>> queryForList(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> elementType) throws DataAccessException
List
, given static CQL.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForList
method with null as argument array.
The results will be mapped to a List
(one item for each row) of result objects, each of them matching the
specified element type.
statement
- static CQL Statement
, must not be null.elementType
- the required type of element in the result List
(for example, Integer.class
),
must not be null.List
of objects that match the specified element type.DataAccessException
- if there is any problem executing the query.queryForList(String, Class, Object[])
,
SingleColumnRowMapper
ListenableFuture<Map<String,Object>> queryForMap(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded 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).
statement
- static CQL Statement
, must not be null.IncorrectResultSizeDataAccessException
- if the query does not return exactly one row.DataAccessException
- if there is any problem executing the query.queryForMap(String, Object[])
,
ColumnMapRowMapper
<T> ListenableFuture<T> queryForObject(com.datastax.oss.driver.api.core.cql.Statement<?> statement, Class<T> requiredType) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded 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.
statement
- static CQL Statement
, must not be null.requiredType
- the type that the result object is expected to match, must not be null.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.queryForObject(String, Class, Object[])
<T> ListenableFuture<T> queryForObject(com.datastax.oss.driver.api.core.cql.Statement<?> statement, RowMapper<T> rowMapper) throws DataAccessException
RowMapper
.
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForObject(String, RowMapper, Object...)
method with
null as argument array.
statement
- static CQL Statement
, must not be null.rowMapper
- object that will map one object per row, must not be null.IncorrectResultSizeDataAccessException
- if the query does not return exactly one row.DataAccessException
- if there is any problem executing the query.queryForObject(String, RowMapper, Object[])
ListenableFuture<com.datastax.oss.driver.api.core.cql.AsyncResultSet> queryForResultSet(com.datastax.oss.driver.api.core.cql.Statement<?> statement) throws DataAccessException
Uses a CQL Statement, not a PreparedStatement
. If you want to execute a static query with a
PreparedStatement
, use the overloaded queryForResultSet
method with null as argument
array.
The results will be mapped to an ResultSet
.
statement
- static CQL Statement
, must not be null.ResultSet
representation.DataAccessException
- if there is any problem executing the query.queryForResultSet(String, Object[])
ListenableFuture<Boolean> execute(AsyncPreparedStatementCreator preparedStatementCreator) throws DataAccessException
AsyncPreparedStatementCreator
to provide CQL and any required parameters.preparedStatementCreator
- object that provides CQL and any necessary parameters, must not be null.DataAccessException
- if there is any problem executing the query.<T> ListenableFuture<T> execute(AsyncPreparedStatementCreator preparedStatementCreator, PreparedStatementCallback<T> action) throws DataAccessException
PreparedStatement
.
This allows for implementing arbitrary data access operations on a single PreparedStatement
, within
Spring's managed CQL environment: that is, participating in Spring-managed transactions and converting CQL
DriverException
s into Spring's DataAccessException
hierarchy.
The callback action can return a result object, for example a domain object or a collection of domain objects.
preparedStatementCreator
- object that can create a PreparedStatement
given a
CqlSession
, must not be null.action
- callback object that specifies the action, must not be null.DataAccessException
- if there is any problem executing the query.<T> ListenableFuture<T> query(AsyncPreparedStatementCreator preparedStatementCreator, AsyncResultSetExtractor<T> resultSetExtractor) throws DataAccessException
ResultSet
with a AsyncResultSetExtractor
.preparedStatementCreator
- object that can create a PreparedStatement
given a
CqlSession
, must not be null.resultSetExtractor
- object that will extract results, must not be null.AsyncResultSetExtractor
DataAccessException
- if there is any problem executing the query.ListenableFuture<Void> query(AsyncPreparedStatementCreator preparedStatementCreator, RowCallbackHandler rowCallbackHandler) throws DataAccessException
ResultSet
on a per-row basis with a
RowCallbackHandler
.preparedStatementCreator
- object that can create a PreparedStatement
given a
CqlSession
, must not be null.rowCallbackHandler
- object that will extract results, one row at a time, must not be null.DataAccessException
- if there is any problem executing the query.<T> ListenableFuture<List<T>> query(AsyncPreparedStatementCreator preparedStatementCreator, RowMapper<T> rowMapper) throws DataAccessException
RowMapper
.preparedStatementCreator
- object that can create a PreparedStatement
given a
CqlSession
, must not be null.rowMapper
- object that will map one object per row, must not be null.List
, containing mapped objects.DataAccessException
- if there is any problem executing the query.<T> ListenableFuture<T> query(AsyncPreparedStatementCreator preparedStatementCreator, @Nullable PreparedStatementBinder psb, AsyncResultSetExtractor<T> resultSetExtractor) throws DataAccessException
PreparedStatementBinder
implementation that knows how to bind values
to the query, reading the ResultSet
with a AsyncResultSetExtractor
.preparedStatementCreator
- object that can create a PreparedStatement
given a
CqlSession
, 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.resultSetExtractor
- object that will extract results, must not be null.AsyncResultSetExtractor
.DataAccessException
- if there is any problem executing the query.ListenableFuture<Void> query(AsyncPreparedStatementCreator preparedStatementCreator, @Nullable PreparedStatementBinder psb, RowCallbackHandler rowCallbackHandler) throws DataAccessException
PreparedStatementBinder
implementation that knows how to bind values
to the query, reading the ResultSet
on a per-row basis with a RowCallbackHandler
.preparedStatementCreator
- object that can create a PreparedStatement
given a
CqlSession
, 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.rowCallbackHandler
- object that will extract results, one row at a time, must not be null.DataAccessException
- if there is any problem executing the query.<T> ListenableFuture<List<T>> query(AsyncPreparedStatementCreator preparedStatementCreator, @Nullable PreparedStatementBinder psb, RowMapper<T> rowMapper) throws DataAccessException
PreparedStatementBinder
implementation that knows how to bind values
to the query, mapping each row to a Java object via a RowMapper
.preparedStatementCreator
- object that can create a PreparedStatement
given a
CqlSession
, 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.List
, containing mapped objects.DataAccessException
- if there is any problem executing the query.Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.