public class CqlTemplate extends CassandraAccessor implements CqlOperations
org.springframework.dao
package.
For working with POJOs, use the CassandraDataTemplate.
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
log |
logger| Constructor and Description |
|---|
CqlTemplate()
Blank constructor.
|
CqlTemplate(com.datastax.driver.core.Session session)
Constructor used for a basic template configuration
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addPreparedStatementOptions(com.datastax.driver.core.PreparedStatement s,
QueryOptions options)
Add common Query options for all types of queries.
|
static com.datastax.driver.core.Statement |
addQueryOptions(com.datastax.driver.core.Statement q,
QueryOptions options)
Add common
Statement options for all types of queries. |
static com.datastax.driver.core.querybuilder.Insert |
addWriteOptions(com.datastax.driver.core.querybuilder.Insert q,
WriteOptions options)
Add common
Query options for Insert queries. |
static com.datastax.driver.core.querybuilder.Update |
addWriteOptions(com.datastax.driver.core.querybuilder.Update q,
WriteOptions options)
Add common
Query options for Update queries. |
long |
count(CqlIdentifier tableName)
Counts all rows for given table
|
long |
count(String tableName)
Counts all rows for given table
|
List<RingMember> |
describeRing()
Describe the current Ring.
|
<T> Collection<T> |
describeRing(HostMapper<T> hostMapper)
Describe the current Ring.
|
protected <T> T |
doExecute(SessionCallback<T> callback)
Execute a command at the Session Level
|
protected com.datastax.driver.core.ResultSet |
doExecute(com.datastax.driver.core.Statement q)
Execute a command at the Session Level with optional options
|
protected com.datastax.driver.core.ResultSet |
doExecute(String cql) |
protected com.datastax.driver.core.ResultSet |
doExecute(String cql,
QueryOptions options) |
protected com.datastax.driver.core.ResultSetFuture |
doExecuteAsync(com.datastax.driver.core.Statement q) |
protected Cancellable |
doExecuteAsync(com.datastax.driver.core.Statement q,
AsynchronousQueryListener listener) |
protected Cancellable |
doExecuteAsync(com.datastax.driver.core.Statement q,
AsynchronousQueryListener listener,
QueryOptions options) |
com.datastax.driver.core.ResultSet |
execute(AlterKeyspaceSpecification specification)
Convenience method to convert the given specification to CQL and execute it.
|
com.datastax.driver.core.ResultSet |
execute(AlterTableSpecification specification)
Convenience method to convert the given specification to CQL and execute it.
|
void |
execute(com.datastax.driver.core.querybuilder.Batch batch)
Executes the supplied Batch Query and returns nothing.
|
com.datastax.driver.core.ResultSet |
execute(CreateIndexSpecification specification)
Convenience method to convert the given specification to CQL and execute it.
|
com.datastax.driver.core.ResultSet |
execute(CreateKeyspaceSpecification specification)
Convenience method to convert the given specification to CQL and execute it.
|
com.datastax.driver.core.ResultSet |
execute(CreateTableSpecification specification)
Convenience method to convert the given specification to CQL and execute it.
|
void |
execute(com.datastax.driver.core.querybuilder.Delete delete)
Executes the supplied Delete Query and returns nothing.
|
com.datastax.driver.core.ResultSet |
execute(DropIndexSpecification specification)
Convenience method to convert the given specification to CQL and execute it.
|
com.datastax.driver.core.ResultSet |
execute(DropKeyspaceSpecification specification)
Convenience method to convert the given specification to CQL and execute it.
|
com.datastax.driver.core.ResultSet |
execute(DropTableSpecification specification)
Convenience method to convert the given specification to CQL and execute it.
|
void |
execute(com.datastax.driver.core.querybuilder.Insert insert)
Executes the supplied Insert Query and returns nothing.
|
<T> T |
execute(PreparedStatementCreator psc,
PreparedStatementCallback<T> action)
Uses the provided
PreparedStatementCreator to create a PreparedStatement in the current
Session, then passes that PreparedStatement to the given PreparedStatementCallback. |
<T> T |
execute(SessionCallback<T> sessionCallback)
Executes the supplied
SessionCallback in the current Template Session. |
void |
execute(com.datastax.driver.core.Statement query)
Executes the supplied Query and returns nothing.
|
void |
execute(String cql)
Executes the supplied CQL Query and returns nothing.
|
<T> T |
execute(String cql,
PreparedStatementCallback<T> action)
Creates and caches a
PreparedStatement from the given CQL, invokes the PreparedStatementCallback
with that PreparedStatement, then returns the value returned by the PreparedStatementCallback. |
void |
execute(String cql,
QueryOptions options)
Executes the supplied CQL Query and returns nothing.
|
void |
execute(com.datastax.driver.core.querybuilder.Truncate truncate)
Executes the supplied Truncate Query and returns nothing.
|
void |
execute(com.datastax.driver.core.querybuilder.Update update)
Executes the supplied Update Query and returns nothing.
|
com.datastax.driver.core.ResultSetFuture |
executeAsynchronously(com.datastax.driver.core.querybuilder.Batch batch)
Executes the supplied CQL Batch Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(com.datastax.driver.core.querybuilder.Batch batch,
AsynchronousQueryListener listener) |
com.datastax.driver.core.ResultSetFuture |
executeAsynchronously(com.datastax.driver.core.querybuilder.Delete delete)
Executes the supplied CQL Delete Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(com.datastax.driver.core.querybuilder.Delete delete,
AsynchronousQueryListener listener) |
com.datastax.driver.core.ResultSetFuture |
executeAsynchronously(com.datastax.driver.core.querybuilder.Insert insert)
Executes the supplied CQL Insert Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(com.datastax.driver.core.querybuilder.Insert insert,
AsynchronousQueryListener listener) |
com.datastax.driver.core.ResultSetFuture |
executeAsynchronously(com.datastax.driver.core.Statement query)
Executes the supplied CQL Query Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(com.datastax.driver.core.Statement query,
AsynchronousQueryListener listener)
Executes the supplied CQL Query Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(com.datastax.driver.core.Statement query,
AsynchronousQueryListener listener,
Executor executor)
Executes the supplied CQL Query Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(com.datastax.driver.core.Statement query,
Runnable listener)
Executes the supplied CQL Query Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(com.datastax.driver.core.Statement query,
Runnable listener,
Executor executor)
Executes the supplied CQL Query Asynchronously and returns nothing.
|
com.datastax.driver.core.ResultSetFuture |
executeAsynchronously(String cql)
Executes the supplied Query Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(String cql,
AsynchronousQueryListener listener)
Executes the supplied Query Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(String cql,
AsynchronousQueryListener listener,
Executor executor)
Executes the supplied Query Asynchronously and returns nothing.
|
com.datastax.driver.core.ResultSetFuture |
executeAsynchronously(String cql,
QueryOptions options)
Executes the supplied Query Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(String cql,
Runnable listener)
Executes the supplied Query Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(String cql,
Runnable listener,
Executor executor)
Executes the supplied Query Asynchronously and returns nothing.
|
com.datastax.driver.core.ResultSetFuture |
executeAsynchronously(com.datastax.driver.core.querybuilder.Truncate truncate)
Executes the supplied CQL Truncate Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(com.datastax.driver.core.querybuilder.Truncate truncate,
AsynchronousQueryListener listener) |
com.datastax.driver.core.ResultSetFuture |
executeAsynchronously(com.datastax.driver.core.querybuilder.Update update)
Executes the supplied CQL Update Asynchronously and returns nothing.
|
Cancellable |
executeAsynchronously(com.datastax.driver.core.querybuilder.Update update,
AsynchronousQueryListener listener) |
protected Object |
firstColumnToObject(com.datastax.driver.core.Row row) |
protected Set<com.datastax.driver.core.Host> |
getHosts()
Pulls the list of Hosts for the current Session
|
com.datastax.driver.core.ResultSet |
getResultSetUninterruptibly(com.datastax.driver.core.ResultSetFuture rsf)
Convenient method that delegates to
ResultSetFuture.getUninterruptibly() but translates exceptions if any
are thrown. |
com.datastax.driver.core.ResultSet |
getResultSetUninterruptibly(com.datastax.driver.core.ResultSetFuture rsf,
long millis)
Convenient method that delegates to
ResultSetFuture.getUninterruptibly() but translates exceptions if any
are thrown. |
com.datastax.driver.core.ResultSet |
getResultSetUninterruptibly(com.datastax.driver.core.ResultSetFuture rsf,
long timeout,
TimeUnit unit)
Convenient method that delegates to
ResultSetFuture.getUninterruptibly() but translates exceptions if any
are thrown. |
void |
ingest(String cql,
List<List<?>> rows)
This is an operation designed for high performance writes.
|
void |
ingest(String cql,
List<List<?>> rows,
WriteOptions options)
This is an operation designed for high performance writes.
|
void |
ingest(String cql,
Object[][] rows)
This is an operation designed for high performance writes.
|
void |
ingest(String cql,
Object[][] rows,
WriteOptions options)
This is an operation designed for high performance writes.
|
void |
ingest(String cql,
RowIterator rowIterator)
This is an operation designed for high performance writes.
|
void |
ingest(String cql,
RowIterator rowIterator,
WriteOptions options)
This is an operation designed for high performance writes.
|
void |
process(com.datastax.driver.core.ResultSet resultSet,
RowCallbackHandler rch)
Processes the ResultSet through the RowCallbackHandler and return nothing.
|
<T> List<T> |
process(com.datastax.driver.core.ResultSet resultSet,
RowMapper<T> rowMapper)
Processes the ResultSet through the RowMapper and returns the List of mapped Rows.
|
<T> List<T> |
processList(com.datastax.driver.core.ResultSet resultSet,
Class<T> elementType)
Process a ResultSet and convert the first column of the results to a List.
|
List<Map<String,Object>> |
processListOfMap(com.datastax.driver.core.ResultSet resultSet)
Process a ResultSet and convert it to a List of Maps with column/value.
|
Map<String,Object> |
processMap(com.datastax.driver.core.ResultSet resultSet)
Process a ResultSet with ONE Row and convert to a Map.
|
<T> T |
processOne(com.datastax.driver.core.ResultSet resultSet,
Class<T> requiredType)
Process a ResultSet, trying to convert the first columns of the first Row to Class
|
<T> T |
processOne(com.datastax.driver.core.ResultSet resultSet,
RowMapper<T> rowMapper)
Process a ResultSet through a RowMapper.
|
<T> T |
query(PreparedStatementCreator psc,
PreparedStatementBinder psb,
ResultSetExtractor<T> rse)
Uses the provided PreparedStatementCreator to prepare a new Session call.
|
<T> T |
query(PreparedStatementCreator psc,
PreparedStatementBinder psb,
ResultSetExtractor<T> rse,
QueryOptions options)
Uses the provided PreparedStatementCreator to prepare a new Session call.
|
void |
query(PreparedStatementCreator psc,
PreparedStatementBinder psb,
RowCallbackHandler rch)
Uses the provided PreparedStatementCreator to prepare a new Session call.
|
void |
query(PreparedStatementCreator psc,
PreparedStatementBinder psb,
RowCallbackHandler rch,
QueryOptions options)
Uses the provided PreparedStatementCreator to prepare a new Session call.
|
<T> List<T> |
query(PreparedStatementCreator psc,
PreparedStatementBinder psb,
RowMapper<T> rowMapper)
Uses the provided PreparedStatementCreator to prepare a new Session call.
|
<T> List<T> |
query(PreparedStatementCreator psc,
PreparedStatementBinder psb,
RowMapper<T> rowMapper,
QueryOptions options)
Uses the provided PreparedStatementCreator to prepare a new Session call.
|
<T> T |
query(PreparedStatementCreator psc,
ResultSetExtractor<T> rse)
Uses the provided PreparedStatementCreator to prepare a new Session call.
|
<T> T |
query(PreparedStatementCreator psc,
ResultSetExtractor<T> rse,
QueryOptions options)
Uses the provided PreparedStatementCreator to prepare a new Session call.
|
void |
query(PreparedStatementCreator psc,
RowCallbackHandler rch)
Uses the provided PreparedStatementCreator to prepare a new Session call.
|
void |
query(PreparedStatementCreator psc,
RowCallbackHandler rch,
QueryOptions options)
Uses the provided PreparedStatementCreator to prepare a new Session call.
|
<T> List<T> |
query(PreparedStatementCreator psc,
RowMapper<T> rowMapper)
Uses the provided PreparedStatementCreator to prepare a new Session call.
|
<T> List<T> |
query(PreparedStatementCreator psc,
RowMapper<T> rowMapper,
QueryOptions options)
Uses the provided PreparedStatementCreator to prepare a new Session call.
|
com.datastax.driver.core.ResultSet |
query(com.datastax.driver.core.querybuilder.Select select)
Executes the provided Select query and returns the
ResultSet. |
<T> T |
query(com.datastax.driver.core.querybuilder.Select select,
ResultSetExtractor<T> rse)
Executes the provided Select Query, and extracts the results with the ResultSetExtractor.
|
void |
query(com.datastax.driver.core.querybuilder.Select select,
RowCallbackHandler rch)
Executes the provided Select Query, and then processes the results with the
RowCallbackHandler. |
<T> List<T> |
query(com.datastax.driver.core.querybuilder.Select select,
RowMapper<T> rowMapper)
Executes the provided Select Query, and maps all Rows returned with the supplied RowMapper.
|
com.datastax.driver.core.ResultSet |
query(String cql)
Executes the provided CQL query and returns the
ResultSet. |
<T> T |
query(String cql,
PreparedStatementBinder psb,
ResultSetExtractor<T> rse)
Converts the CQL provided into a
CachedPreparedStatementCreator. |
<T> T |
query(String cql,
PreparedStatementBinder psb,
ResultSetExtractor<T> rse,
QueryOptions options)
Converts the CQL provided into a
CachedPreparedStatementCreator. |
void |
query(String cql,
PreparedStatementBinder psb,
RowCallbackHandler rch)
Converts the CQL provided into a
CachedPreparedStatementCreator. |
void |
query(String cql,
PreparedStatementBinder psb,
RowCallbackHandler rch,
QueryOptions options)
Converts the CQL provided into a
CachedPreparedStatementCreator. |
<T> List<T> |
query(String cql,
PreparedStatementBinder psb,
RowMapper<T> rowMapper)
Converts the CQL provided into a
CachedPreparedStatementCreator. |
<T> List<T> |
query(String cql,
PreparedStatementBinder psb,
RowMapper<T> rowMapper,
QueryOptions options)
Converts the CQL provided into a
CachedPreparedStatementCreator. |
com.datastax.driver.core.ResultSet |
query(String cql,
QueryOptions options)
Executes the provided CQL query with the given
QueryOptions and returns the ResultSet. |
<T> T |
query(String cql,
ResultSetExtractor<T> rse)
Executes the provided CQL Query, and extracts the results with the ResultSetExtractor.
|
<T> T |
query(String cql,
ResultSetExtractor<T> rse,
QueryOptions options)
Executes the provided CQL Query, and extracts the results with the ResultSetExtractor.
|
void |
query(String cql,
RowCallbackHandler rch)
Executes the provided CQL Query, and then processes the results with the
RowCallbackHandler. |
void |
query(String cql,
RowCallbackHandler rch,
QueryOptions options)
Executes the provided CQL Query, and then processes the results with the
RowCallbackHandler. |
<T> List<T> |
query(String cql,
RowMapper<T> rowMapper)
Executes the provided CQL Query, and maps all Rows returned with the supplied RowMapper.
|
<T> List<T> |
query(String cql,
RowMapper<T> rowMapper,
QueryOptions options)
Executes the provided CQL Query, and maps all Rows returned with the supplied RowMapper.
|
com.datastax.driver.core.ResultSetFuture |
queryAsynchronously(com.datastax.driver.core.querybuilder.Select select)
Executes the provided CQL Select and returns the ResultSetFuture for user processing.
|
Cancellable |
queryAsynchronously(com.datastax.driver.core.querybuilder.Select select,
AsynchronousQueryListener listener)
Executes the provided CQL Select with the provided listener.
|
Cancellable |
queryAsynchronously(com.datastax.driver.core.querybuilder.Select select,
AsynchronousQueryListener listener,
Executor executor)
Executes the provided Select Query with the provided listener and executor.
|
Cancellable |
queryAsynchronously(com.datastax.driver.core.querybuilder.Select select,
Runnable listener)
Executes the provided CQL Select with the provided
Runnable, which is started after the query has
completed. |
Cancellable |
queryAsynchronously(com.datastax.driver.core.querybuilder.Select select,
Runnable listener,
Executor executor)
Executes the provided CQL Select with the provided Executor and Runnable implementations.
|
com.datastax.driver.core.ResultSetFuture |
queryAsynchronously(String cql)
Executes the provided CQL Query and returns the ResultSetFuture for user processing.
|
Cancellable |
queryAsynchronously(String cql,
AsynchronousQueryListener listener)
Executes the provided CQL Query with the provided listener.
|
Cancellable |
queryAsynchronously(String cql,
AsynchronousQueryListener listener,
Executor executor)
Executes the provided CQL Query with the provided listener and executor.
|
Cancellable |
queryAsynchronously(String cql,
AsynchronousQueryListener listener,
QueryOptions options)
Executes the provided CQL Query with the provided Listener and Query Options.
|
Cancellable |
queryAsynchronously(String cql,
AsynchronousQueryListener listener,
QueryOptions options,
Executor executor)
Executes the provided CQL Query with the provided Listener, Executor and Query Options.
|
com.datastax.driver.core.ResultSetFuture |
queryAsynchronously(String cql,
QueryOptions options)
Executes the provided CQL Query and returns the ResultSetFuture for user processing.
|
<T> T |
queryAsynchronously(String cql,
ResultSetExtractor<T> rse,
Long timeout,
TimeUnit timeUnit)
Executes the provided CQL Query, and extracts the results with the ResultSetExtractor.
|
<T> T |
queryAsynchronously(String cql,
ResultSetExtractor<T> rse,
Long timeout,
TimeUnit timeUnit,
QueryOptions options)
Executes the provided CQL Query, and extracts the results with the ResultSetExtractor.
|
<T> T |
queryAsynchronously(String cql,
ResultSetFutureExtractor<T> rse) |
<T> T |
queryAsynchronously(String cql,
ResultSetFutureExtractor<T> rse,
QueryOptions options) |
Cancellable |
queryAsynchronously(String cql,
Runnable listener)
Executes the provided CQL Query with the provided
Runnable, which is started after the query has completed. |
Cancellable |
queryAsynchronously(String cql,
Runnable listener,
Executor executor)
Executes the provided CQL Query with the provided Executor and Runnable implementations.
|
Cancellable |
queryAsynchronously(String cql,
Runnable listener,
QueryOptions options)
Executes the provided CQL Query with the Runnable implementations using the Query Options.
|
Cancellable |
queryAsynchronously(String cql,
Runnable listener,
QueryOptions options,
Executor executor)
Executes the provided CQL Query with the provided Executor and Runnable implementations.
|
<T> List<T> |
queryForList(com.datastax.driver.core.querybuilder.Select select,
Class<T> elementType)
Executes the provided Select Query and returns all values in the first column of the Results as a List of the Type
in the second argument.
|
<T> List<T> |
queryForList(String cql,
Class<T> elementType)
Executes the provided CQL and returns all values in the first column of the Results as a List of the Type in the
second argument.
|
<T> Cancellable |
queryForListAsynchronously(com.datastax.driver.core.querybuilder.Select select,
Class<T> elementType,
QueryForListListener<T> listener)
Executes the provided
Select query asynchronously and returns all values in the first column of the results
as a List of the type in the second argument. |
<T> Cancellable |
queryForListAsynchronously(String select,
Class<T> elementType,
QueryForListListener<T> listener)
Executes the provided
Select query asynchronously and returns all values in the first column of the results
as a List of the type in the second argument. |
List<Map<String,Object>> |
queryForListOfMap(com.datastax.driver.core.querybuilder.Select select)
Executes the provided Select Query and converts the results to a basic List of Maps.
|
List<Map<String,Object>> |
queryForListOfMap(String cql)
Executes the provided CQL and converts the results to a basic List of Maps.
|
Cancellable |
queryForListOfMapAsynchronously(com.datastax.driver.core.querybuilder.Select select,
QueryForListListener<Map<String,Object>> listener)
|
Cancellable |
queryForListOfMapAsynchronously(String cql,
QueryForListListener<Map<String,Object>> listener)
|
Cancellable |
queryForListOfMapAsynchronously(String cql,
QueryForListListener<Map<String,Object>> listener,
QueryOptions options)
|
Map<String,Object> |
queryForMap(com.datastax.driver.core.querybuilder.Select select)
Executes the provided Select Query and maps ONE Row to a basic Map of Strings and Objects.
|
Map<String,Object> |
queryForMap(String cql)
Executes the provided CQL Query and maps ONE Row to a basic Map of Strings and Objects.
|
Cancellable |
queryForMapAsynchronously(com.datastax.driver.core.querybuilder.Select select,
QueryForMapListener listener)
Executes the provided
Select query asynchronously and maps the first row to a Map
<String,Object>. |
Cancellable |
queryForMapAsynchronously(String cql,
QueryForMapListener listener)
Executes the provided CQL query asynchronously and maps the first row to a
Map<String,Object>. |
Cancellable |
queryForMapAsynchronously(String cql,
QueryForMapListener listener,
QueryOptions options)
Executes the provided CQL query asynchronously and maps the first row to a
Map<String,Object>. |
<T> T |
queryForObject(com.datastax.driver.core.querybuilder.Select select,
Class<T> requiredType)
Executes the provided Select query and tries to return the first column of the first Row as a Class
|
<T> T |
queryForObject(com.datastax.driver.core.querybuilder.Select select,
RowMapper<T> rowMapper)
Executes the provided Select Query, and maps ONE Row returned with the supplied RowMapper.
|
<T> T |
queryForObject(String cql,
Class<T> requiredType)
Executes the provided query and tries to return the first column of the first Row as a Class
|
<T> T |
queryForObject(String cql,
RowMapper<T> rowMapper)
Executes the provided CQL Query, and maps ONE Row returned with the supplied RowMapper.
|
<T> Cancellable |
queryForObjectAsynchronously(com.datastax.driver.core.querybuilder.Select select,
Class<T> requiredType,
QueryForObjectListener<T> listener)
Executes the provided
Select query and returns the first column of the first Row as an object of type
T. |
<T> Cancellable |
queryForObjectAsynchronously(com.datastax.driver.core.querybuilder.Select select,
RowMapper<T> rowMapper,
QueryForObjectListener<T> listener)
Executes the provided
Select query, and maps the first row returned with the supplied RowMapper. |
<T> Cancellable |
queryForObjectAsynchronously(String cql,
Class<T> requiredType,
QueryForObjectListener<T> listener)
Executes the provided select CQL query and returns the first column of the first Row as an object of type
T. |
<T> Cancellable |
queryForObjectAsynchronously(String cql,
Class<T> requiredType,
QueryForObjectListener<T> listener,
QueryOptions options)
Executes the provided select CQL query and returns the first column of the first Row as an object of type
T. |
<T> Cancellable |
queryForObjectAsynchronously(String cql,
RowMapper<T> rowMapper,
QueryForObjectListener<T> listener)
Executes the provided string CQL query, and maps the first row returned with the supplied
RowMapper. |
<T> Cancellable |
queryForObjectAsynchronously(String cql,
RowMapper<T> rowMapper,
QueryForObjectListener<T> listener,
QueryOptions options)
Executes the provided string CQL query, and maps the first row returned with the supplied
RowMapper. |
protected long |
selectCount(com.datastax.driver.core.querybuilder.Select select) |
protected Map<String,Object> |
toMap(com.datastax.driver.core.Row row) |
protected RuntimeException |
translateExceptionIfPossible(Exception ex) |
protected RuntimeException |
translateExceptionIfPossible(RuntimeException ex)
Attempt to translate a Runtime Exception to a Spring Data Exception
|
void |
truncate(CqlIdentifier tableName)
Delete all rows in the table
|
void |
truncate(String tableName)
Delete all rows in the table
|
afterPropertiesSet, getExceptionTranslator, getSession, setExceptionTranslator, setSessionclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSessionpublic CqlTemplate()
public CqlTemplate(com.datastax.driver.core.Session session)
session - must not be null.public static com.datastax.driver.core.Statement addQueryOptions(com.datastax.driver.core.Statement q,
QueryOptions options)
Statement options for all types of queries.q - options - Statement given.public static com.datastax.driver.core.querybuilder.Insert addWriteOptions(com.datastax.driver.core.querybuilder.Insert q,
WriteOptions options)
Query options for Insert queries.q - options - Query given.public static com.datastax.driver.core.querybuilder.Update addWriteOptions(com.datastax.driver.core.querybuilder.Update q,
WriteOptions options)
Query options for Update queries.q - options - Query given.public static void addPreparedStatementOptions(com.datastax.driver.core.PreparedStatement s,
QueryOptions options)
q - optionsByName - public <T> T execute(SessionCallback<T> sessionCallback) throws DataAccessException
CqlOperationsSessionCallback in the current Template Session. The implementation of
SessionCallback can decide whether or not to execute() or executeAsync() the operation.execute in interface CqlOperationsDataAccessExceptionpublic void execute(String cql) throws DataAccessException
CqlOperationsexecute in interface CqlOperationsDataAccessExceptionpublic void execute(String cql, QueryOptions options) throws DataAccessException
CqlOperationsexecute in interface CqlOperationsoptions - may be nullDataAccessExceptionpublic void execute(com.datastax.driver.core.Statement query)
throws DataAccessException
CqlOperationsexecute in interface CqlOperationsquery - The Statement to executeDataAccessExceptionpublic com.datastax.driver.core.ResultSetFuture queryAsynchronously(String cql)
CqlOperationsqueryAsynchronously in interface CqlOperationscql - The Querypublic <T> T queryAsynchronously(String cql, ResultSetExtractor<T> rse, Long timeout, TimeUnit timeUnit)
CqlOperationsqueryAsynchronously in interface CqlOperationscql - The Queryrse - The implementation for extracting the ResultSettimeout - Time to wait for resultstimeUnit - Time unit to wait for resultspublic <T> T queryAsynchronously(String cql, ResultSetExtractor<T> rse, Long timeout, TimeUnit timeUnit, QueryOptions options)
CqlOperationsqueryAsynchronously in interface CqlOperationscql - The Queryrse - The implementation for extracting the ResultSettimeout - Time to wait for resultstimeUnit - Time unit to wait for resultsoptions - Query Optionspublic com.datastax.driver.core.ResultSetFuture queryAsynchronously(String cql, QueryOptions options)
CqlOperationsqueryAsynchronously in interface CqlOperationscql - The Queryoptions - Query Optionspublic Cancellable queryAsynchronously(String cql, Runnable listener)
CqlOperationsRunnable, which is started after the query has completed.
A more useful method than this one is CqlOperations.queryAsynchronously(String, AsynchronousQueryListener), where you're
given the ResultSetFuture after the query has been executed.queryAsynchronously in interface CqlOperationscql - The Querylistener - Runnable listener for handling the query in a separate threadCancellable that can be used to cancel the query.CqlOperations.queryAsynchronously(String, AsynchronousQueryListener)public Cancellable queryAsynchronously(String cql, AsynchronousQueryListener listener)
CqlOperationsRunnable. The AsynchronousQueryListener gives you access to the ResultSetFuture once the
query is completed for optimal flexibility.queryAsynchronously in interface CqlOperationscql - The Querylistener - AsynchronousQueryListener for handling the query's ResultSetFuture in a separate
threadCancellable that can be used to cancel the query.public Cancellable queryAsynchronously(String cql, Runnable listener, QueryOptions options)
CqlOperationsqueryAsynchronously in interface CqlOperationscql - The Querylistener - Runnable Listener for handling the query in a separate threadoptions - Query OptionCancellable that can be used to cancel the query.public Cancellable queryAsynchronously(String cql, AsynchronousQueryListener listener, QueryOptions options)
CqlOperationsAsynchronousQueryListener gives you access to the
ResultSetFuture once the query is completed for optimal flexibility.queryAsynchronously in interface CqlOperationscql - The Querylistener - Runnable Listener for handling the query in a separate threadoptions - Query OptionCancellable that can be used to cancel the query.public Cancellable queryAsynchronously(String cql, Runnable listener, Executor executor)
CqlOperationsqueryAsynchronously in interface CqlOperationscql - The Querylistener - Runnable Listener for handling the query in a separate threadexecutor - To execute the Runnable ListenerCancellable that can be used to cancel the query.public Cancellable queryAsynchronously(String cql, AsynchronousQueryListener listener, Executor executor)
CqlOperationsAsynchronousQueryListener gives you access to the ResultSetFuture
once the query is completed for optimal flexibility.queryAsynchronously in interface CqlOperationscql - The Querylistener - Runnable Listener for handling the query in a separate threadexecutor - To execute the Runnable ListenerCancellable that can be used to cancel the query.public Cancellable queryAsynchronously(String cql, Runnable listener, QueryOptions options, Executor executor)
CqlOperationsqueryAsynchronously in interface CqlOperationscql - The Querylistener - Runnable Listener for handling the query in a separate threadoptions - Query Optionexecutor - To execute the Runnable ListenerCancellable that can be used to cancel the query.public Cancellable queryAsynchronously(String cql, AsynchronousQueryListener listener, QueryOptions options, Executor executor)
CqlOperationsAsynchronousQueryListener gives you access to the
ResultSetFuture once the query is completed for optimal flexibility.queryAsynchronously in interface CqlOperationsCancellable that can be used to cancel the query.public <T> T queryAsynchronously(String cql, ResultSetFutureExtractor<T> rse, QueryOptions options) throws DataAccessException
DataAccessExceptionpublic <T> T queryAsynchronously(String cql, ResultSetFutureExtractor<T> rse) throws DataAccessException
DataAccessExceptionpublic <T> T query(String cql, ResultSetExtractor<T> rse) throws DataAccessException
CqlOperationsquery in interface CqlOperationscql - The Queryrse - The implementation for extracting the ResultSetDataAccessExceptionpublic <T> T query(String cql, ResultSetExtractor<T> rse, QueryOptions options) throws DataAccessException
CqlOperationsquery in interface CqlOperationscql - The Queryrse - The implementation for extracting the ResultSetoptions - Query OptionsDataAccessExceptionpublic void query(String cql, RowCallbackHandler rch, QueryOptions options) throws DataAccessException
CqlOperationsRowCallbackHandler.query in interface CqlOperationscql - The Queryrch - The implementation for processing the rows returned.options - Query Options ObjectDataAccessExceptionpublic void query(String cql, RowCallbackHandler rch) throws DataAccessException
CqlOperationsRowCallbackHandler.query in interface CqlOperationscql - The Queryrch - The implementation for processing the rows returned.DataAccessExceptionpublic <T> List<T> query(String cql, RowMapper<T> rowMapper, QueryOptions options) throws DataAccessException
CqlOperationsquery in interface CqlOperationscql - The QueryrowMapper - The implementation for mapping all rowsoptions - Query Options ObjectDataAccessExceptionpublic com.datastax.driver.core.ResultSet query(String cql)
CqlOperationsResultSet.query in interface CqlOperationscql - The queryResultSetpublic com.datastax.driver.core.ResultSet query(String cql, QueryOptions options)
CqlOperationsQueryOptions and returns the ResultSet.query in interface CqlOperationscql - The queryoptions - The QueryOptions; may be null.ResultSetpublic <T> List<T> query(String cql, RowMapper<T> rowMapper) throws DataAccessException
CqlOperationsquery in interface CqlOperationscql - The QueryrowMapper - The implementation for mapping all rowsDataAccessExceptionpublic List<Map<String,Object>> queryForListOfMap(String cql) throws DataAccessException
CqlOperationsqueryForListOfMap in interface CqlOperationscql - The QueryDataAccessExceptionpublic <T> List<T> queryForList(String cql, Class<T> elementType) throws DataAccessException
CqlOperationsqueryForList in interface CqlOperationscql - The QueryelementType - Type to cast the data values toDataAccessExceptionpublic Map<String,Object> queryForMap(String cql) throws DataAccessException
CqlOperationsqueryForMap in interface CqlOperationscql - The QueryDataAccessExceptionpublic <T> T queryForObject(String cql, Class<T> requiredType) throws DataAccessException
CqlOperationsqueryForObject in interface CqlOperationscql - The QueryrequiredType - Valid Class that Cassandra Data Types can be converted to.DataAccessExceptionpublic <T> T queryForObject(String cql, RowMapper<T> rowMapper) throws DataAccessException
CqlOperationsThis expects only ONE row to be returned. More than one Row will cause an Exception to be thrown.
queryForObject in interface CqlOperationscql - The QueryrowMapper - The implementation for convert the Row to DataAccessExceptionprotected <T> T doExecute(SessionCallback<T> callback)
callback - protected com.datastax.driver.core.ResultSet doExecute(String cql)
protected com.datastax.driver.core.ResultSet doExecute(String cql, QueryOptions options)
protected com.datastax.driver.core.ResultSet doExecute(com.datastax.driver.core.Statement q)
q - The query to execute.options - The QueryOptions. May be null.protected com.datastax.driver.core.ResultSetFuture doExecuteAsync(com.datastax.driver.core.Statement q)
protected Cancellable doExecuteAsync(com.datastax.driver.core.Statement q, AsynchronousQueryListener listener)
protected Cancellable doExecuteAsync(com.datastax.driver.core.Statement q, AsynchronousQueryListener listener, QueryOptions options)
protected Object firstColumnToObject(com.datastax.driver.core.Row row)
row - protected Map<String,Object> toMap(com.datastax.driver.core.Row row)
row - public List<RingMember> describeRing() throws DataAccessException
CqlOperationsRingMemberHostMapper to provide the basics of the
Cassandra Ring topology.describeRing in interface CqlOperationsDataAccessExceptionprotected Set<com.datastax.driver.core.Host> getHosts()
public <T> Collection<T> describeRing(HostMapper<T> hostMapper) throws DataAccessException
CqlOperationsHostMapper implementation to process the
lists of hosts returned by the Cassandra Cluster Metadata.describeRing in interface CqlOperationshostMapper - The implementation to use for host mapping.DataAccessExceptionpublic com.datastax.driver.core.ResultSetFuture executeAsynchronously(String cql) throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationscql - The CQL String to executeResultSetFuture that can be used to cancel the query.DataAccessExceptionpublic com.datastax.driver.core.ResultSetFuture executeAsynchronously(String cql, QueryOptions options) throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationscql - The CQL String to executeoptions - The QueryOptions to use. Only applies to cql statements that can use QueryOptions.ResultSetFuture that can be used to cancel the query.DataAccessExceptionpublic Cancellable executeAsynchronously(String cql, Runnable listener) throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationscql - The CQL String to executelistener - The Runnable to register with the ResultSetFutureCancellable that can be used to cancel the query.DataAccessExceptionfor Readspublic Cancellable executeAsynchronously(String cql, Runnable listener, Executor executor) throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationscql - The CQL String to executelistener - The Runnable to register with the ResultSetFutureexecutor - The Executor to regsiter with the ResultSetFutureCancellable that can be used to cancel the query.DataAccessExceptionfor Readspublic Cancellable executeAsynchronously(String cql, AsynchronousQueryListener listener) throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationscql - The CQL String to executelistener - The AsynchronousQueryListener to register with the ResultSetFutureCancellable that can be used to cancel the query.DataAccessExceptionfor Readspublic Cancellable executeAsynchronously(String cql, AsynchronousQueryListener listener, Executor executor) throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationscql - The CQL String to executelistener - The AsynchronousQueryListener to register with the ResultSetFutureexecutor - The Executor to regsiter with the ResultSetFutureCancellable that can be used to cancel the query.DataAccessExceptionfor Readspublic com.datastax.driver.core.ResultSetFuture executeAsynchronously(com.datastax.driver.core.Statement query)
throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationsquery - The Statement to executeResultSetFuture that can be used to cancel the query.DataAccessExceptionpublic Cancellable executeAsynchronously(com.datastax.driver.core.Statement query, Runnable listener) throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationsquery - The Statement to executeCancellable that can be used to cancel the query.DataAccessExceptionpublic Cancellable executeAsynchronously(com.datastax.driver.core.Statement query, AsynchronousQueryListener listener) throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationsquery - The Statement to executeCancellable that can be used to cancel the query.DataAccessExceptionpublic Cancellable executeAsynchronously(com.datastax.driver.core.Statement query, Runnable listener, Executor executor) throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationsquery - The Statement to executeCancellable that can be used to cancel the query.DataAccessExceptionpublic Cancellable executeAsynchronously(com.datastax.driver.core.Statement query, AsynchronousQueryListener listener, Executor executor) throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationsquery - The Statement to executeCancellable that can be used to cancel the query.DataAccessExceptionpublic void process(com.datastax.driver.core.ResultSet resultSet,
RowCallbackHandler rch)
throws DataAccessException
CqlOperationsprocess in interface CqlOperationsresultSet - Results to processrch - RowCallbackHandler with the processing implementationDataAccessExceptionpublic <T> List<T> process(com.datastax.driver.core.ResultSet resultSet, RowMapper<T> rowMapper) throws DataAccessException
CqlOperationsprocess in interface CqlOperationsresultSet - Results to processrowMapper - RowMapper with the processing implementationDataAccessExceptionpublic <T> T processOne(com.datastax.driver.core.ResultSet resultSet,
RowMapper<T> rowMapper)
throws DataAccessException
CqlOperationsprocessOne in interface CqlOperationsDataAccessExceptionpublic <T> T processOne(com.datastax.driver.core.ResultSet resultSet,
Class<T> requiredType)
throws DataAccessException
CqlOperationsprocessOne in interface CqlOperationsDataAccessExceptionpublic Map<String,Object> processMap(com.datastax.driver.core.ResultSet resultSet) throws DataAccessException
CqlOperationsprocessMap in interface CqlOperationsDataAccessExceptionpublic <T> List<T> processList(com.datastax.driver.core.ResultSet resultSet, Class<T> elementType) throws DataAccessException
CqlOperationsprocessList in interface CqlOperationsDataAccessExceptionpublic List<Map<String,Object>> processListOfMap(com.datastax.driver.core.ResultSet resultSet) throws DataAccessException
CqlOperationsprocessListOfMap in interface CqlOperationsDataAccessExceptionprotected RuntimeException translateExceptionIfPossible(RuntimeException ex)
ex - protected RuntimeException translateExceptionIfPossible(Exception ex)
public <T> T execute(PreparedStatementCreator psc, PreparedStatementCallback<T> action)
CqlOperationsPreparedStatementCreator to create a PreparedStatement in the current
Session, then passes that PreparedStatement to the given PreparedStatementCallback.execute in interface CqlOperationspsc - The PreparedStatementCreatoraction - The callback that receives the PreparedStatementPreparedStatementCallbackpublic <T> T execute(String cql, PreparedStatementCallback<T> action)
CqlOperationsPreparedStatement from the given CQL, invokes the PreparedStatementCallback
with that PreparedStatement, then returns the value returned by the PreparedStatementCallback.execute in interface CqlOperationscql - The CQL statement from which to create and cache a PreparedStatementaction - The callback that is given the PreparedStatementPreparedStatementCallbackpublic <T> T query(PreparedStatementCreator psc, ResultSetExtractor<T> rse, QueryOptions options) throws DataAccessException
CqlOperationsquery in interface CqlOperationspsc - The implementation to create the PreparedStatementrse - Implementation for extracting from the ResultSetoptions - The Query Options ObjectDataAccessExceptionpublic <T> T query(PreparedStatementCreator psc, ResultSetExtractor<T> rse) throws DataAccessException
CqlOperationsquery in interface CqlOperationspsc - The implementation to create the PreparedStatementrse - Implementation for extracting from the ResultSetDataAccessExceptionpublic void query(PreparedStatementCreator psc, RowCallbackHandler rch, QueryOptions options) throws DataAccessException
CqlOperationsquery in interface CqlOperationspsc - The implementation to create the PreparedStatementrch - The implementation to process Resultsoptions - The Query Options ObjectDataAccessExceptionpublic void query(PreparedStatementCreator psc, RowCallbackHandler rch) throws DataAccessException
CqlOperationsquery in interface CqlOperationspsc - The implementation to create the PreparedStatementrch - The implementation to process ResultsDataAccessExceptionpublic <T> List<T> query(PreparedStatementCreator psc, RowMapper<T> rowMapper, QueryOptions options) throws DataAccessException
CqlOperationsquery in interface CqlOperationspsc - The implementation to create the PreparedStatementrowMapper - The implementation for mapping each Row returned.options - The Query Options ObjectDataAccessExceptionpublic <T> List<T> query(PreparedStatementCreator psc, RowMapper<T> rowMapper) throws DataAccessException
CqlOperationsquery in interface CqlOperationspsc - The implementation to create the PreparedStatementrowMapper - The implementation for mapping each Row returned.DataAccessExceptionpublic <T> T query(String cql, PreparedStatementBinder psb, ResultSetExtractor<T> rse, QueryOptions options) throws DataAccessException
CqlOperationsCachedPreparedStatementCreator. Then, the PreparedStatementBinder will
bind its values to the bind variables in the provided CQL String. The results of the PreparedStatement are
processed with the ResultSetExtractor implementation provided by the Application Code. The can return any object,
including a List of Objects to support the ResultSet processing.query in interface CqlOperationscql - The Query to Preparepsb - The Binding implementationrse - The implementation for extracting the results of the query.options - The Query Options to apply to the PreparedStatementDataAccessExceptionpublic <T> T query(String cql, PreparedStatementBinder psb, ResultSetExtractor<T> rse) throws DataAccessException
CqlOperationsCachedPreparedStatementCreator. Then, the PreparedStatementBinder will
bind its values to the bind variables in the provided CQL String. The results of the PreparedStatement are
processed with the ResultSetExtractor implementation provided by the Application Code. The can return any object,
including a List of Objects to support the ResultSet processing.query in interface CqlOperationscql - The Query to Preparepsb - The Binding implementationrse - The implementation for extracting the results of the query.DataAccessExceptionpublic void query(String cql, PreparedStatementBinder psb, RowCallbackHandler rch, QueryOptions options) throws DataAccessException
CqlOperationsCachedPreparedStatementCreator. Then, the PreparedStatementBinder will
bind its values to the bind variables in the provided CQL String. The results of the PreparedStatement are
processed with the RowCallbackHandler implementation provided and nothing is returned.query in interface CqlOperationscql - The Query to Preparepsb - The Binding implementationrch - The RowCallbackHandler for processing the ResultSetoptions - The Query Options ObjectDataAccessExceptionpublic void query(String cql, PreparedStatementBinder psb, RowCallbackHandler rch) throws DataAccessException
CqlOperationsCachedPreparedStatementCreator. Then, the PreparedStatementBinder will
bind its values to the bind variables in the provided CQL String. The results of the PreparedStatement are
processed with the RowCallbackHandler implementation provided and nothing is returned.query in interface CqlOperationscql - The Query to Preparepsb - The Binding implementationrch - The RowCallbackHandler for processing the ResultSetDataAccessExceptionpublic <T> List<T> query(String cql, PreparedStatementBinder psb, RowMapper<T> rowMapper, QueryOptions options) throws DataAccessException
CqlOperationsCachedPreparedStatementCreator. Then, the PreparedStatementBinder will
bind its values to the bind variables in the provided CQL String. The results of the PreparedStatement are
processed with the RowMapper implementation provided and a List is returned with elements of Type query in interface CqlOperationscql - The Query to Preparepsb - The Binding implementationrowMapper - The implementation for Mapping a Row to Type options - The Query Options ObjectDataAccessExceptionpublic <T> List<T> query(String cql, PreparedStatementBinder psb, RowMapper<T> rowMapper) throws DataAccessException
CqlOperationsCachedPreparedStatementCreator. Then, the PreparedStatementBinder will
bind its values to the bind variables in the provided CQL String. The results of the PreparedStatement are
processed with the RowMapper implementation provided and a List is returned with elements of Type query in interface CqlOperationscql - The Query to Preparepsb - The Binding implementationrowMapper - The implementation for Mapping a Row to Type DataAccessExceptionpublic void ingest(String cql, RowIterator rowIterator, WriteOptions options)
CqlOperationsThis is used internally by the other ingest() methods, but can be used if you want to write your own RowIterator. The Object[] length returned by the next() implementation must match the number of bind variables in the CQL.
ingest in interface CqlOperationscql - The CQLrowIterator - Implementation to provide the Object[] to be bound to the CQL.options - The Query Options Objectpublic void ingest(String cql, RowIterator rowIterator)
CqlOperationsThis is used internally by the other ingest() methods, but can be used if you want to write your own RowIterator. The Object[] length returned by the next() implementation must match the number of bind variables in the CQL.
ingest in interface CqlOperationscql - The CQLrowIterator - Implementation to provide the Object[] to be bound to the CQL.public void ingest(String cql, List<List<?>> rows, WriteOptions options)
CqlOperationsThe List> length must match the number of bind variables in the CQL.
ingest in interface CqlOperationscql - The CQLrows - List of List> with data to bind to the CQL.options - The Query Options Objectpublic void ingest(String cql, List<List<?>> rows)
CqlOperationsPreparedStatement
once, then all row values are bound to that PreparedStatement and executed against the Session.
The lengths of the nested Lists must not be less than the number of bind variables in the CQL.
ingest in interface CqlOperationscql - The CQLrows - The data to bind to the CQL statementpublic void ingest(String cql, Object[][] rows, WriteOptions options)
CqlOperationsPreparedStatement
once, then all row values are bound to that PreparedStatement and executed against the Session.
The lengths of the nested object arrays must not be less than the number of bind variables in the CQL.
ingest in interface CqlOperationscql - The CQLrows - The data to bind to the CQL statementoptions - The Query Options Objectpublic void ingest(String cql, Object[][] rows)
CqlOperationsPreparedStatement
once, then all row values are bound to that PreparedStatement and executed against the Session.
The lengths of the nested object arrays must not be less than the number of bind variables in the CQL.
ingest in interface CqlOperationscql - The CQLrows - The data to bind to the CQL statementpublic void truncate(String tableName) throws DataAccessException
CqlOperationstruncate in interface CqlOperationsDataAccessExceptionpublic void truncate(CqlIdentifier tableName) throws DataAccessException
CqlOperationstruncate in interface CqlOperationsDataAccessExceptionpublic <T> T query(PreparedStatementCreator psc, PreparedStatementBinder psb, ResultSetExtractor<T> rse, QueryOptions options) throws DataAccessException
CqlOperationsquery in interface CqlOperationspsc - The implementation to create the PreparedStatementpsb - The implementation to bind variables to valuesrse - Implementation for extracting from the ResultSetoptions - The Query Options ObjectDataAccessExceptionpublic <T> T query(PreparedStatementCreator psc, PreparedStatementBinder psb, ResultSetExtractor<T> rse) throws DataAccessException
CqlOperationsquery in interface CqlOperationspsc - The implementation to create the PreparedStatementpsb - The implementation to bind variables to valuesrse - Implementation for extracting from the ResultSetDataAccessExceptionpublic void query(PreparedStatementCreator psc, PreparedStatementBinder psb, RowCallbackHandler rch, QueryOptions options) throws DataAccessException
CqlOperationsquery in interface CqlOperationspsc - The implementation to create the PreparedStatementpsb - The implementation to bind variables to valuesrch - The implementation to process Resultsoptions - The Query Options ObjectDataAccessExceptionpublic void query(PreparedStatementCreator psc, PreparedStatementBinder psb, RowCallbackHandler rch) throws DataAccessException
CqlOperationsquery in interface CqlOperationspsc - The implementation to create the PreparedStatementpsb - The implementation to bind variables to valuesrch - The implementation to process ResultsDataAccessExceptionpublic <T> List<T> query(PreparedStatementCreator psc, PreparedStatementBinder psb, RowMapper<T> rowMapper, QueryOptions options) throws DataAccessException
CqlOperationsquery in interface CqlOperationspsc - The implementation to create the PreparedStatementpsb - The implementation to bind variables to valuesrowMapper - The implementation for mapping each Row returned.options - The Query Options ObjectDataAccessExceptionpublic <T> List<T> query(PreparedStatementCreator psc, PreparedStatementBinder psb, RowMapper<T> rowMapper) throws DataAccessException
CqlOperationsquery in interface CqlOperationspsc - The implementation to create the PreparedStatementpsb - The implementation to bind variables to valuesrowMapper - The implementation for mapping each Row returned.DataAccessExceptionpublic com.datastax.driver.core.ResultSet execute(DropTableSpecification specification)
CqlOperationsexecute in interface CqlOperationsspecification - The specification to execute; must not be null.public com.datastax.driver.core.ResultSet execute(CreateTableSpecification specification)
CqlOperationsexecute in interface CqlOperationsspecification - The specification to execute; must not be null.public com.datastax.driver.core.ResultSet execute(AlterTableSpecification specification)
CqlOperationsexecute in interface CqlOperationsspecification - The specification to execute; must not be null.public com.datastax.driver.core.ResultSet execute(DropKeyspaceSpecification specification)
CqlOperationsexecute in interface CqlOperationsspecification - The specification to execute; must not be null.public com.datastax.driver.core.ResultSet execute(CreateKeyspaceSpecification specification)
CqlOperationsexecute in interface CqlOperationsspecification - The specification to execute; must not be null.public com.datastax.driver.core.ResultSet execute(AlterKeyspaceSpecification specification)
CqlOperationsexecute in interface CqlOperationsspecification - The specification to execute; must not be null.public com.datastax.driver.core.ResultSet execute(DropIndexSpecification specification)
CqlOperationsexecute in interface CqlOperationsspecification - The specification to execute; must not be null.public com.datastax.driver.core.ResultSet execute(CreateIndexSpecification specification)
CqlOperationsexecute in interface CqlOperationsspecification - The specification to execute; must not be null.public void execute(com.datastax.driver.core.querybuilder.Delete delete)
throws DataAccessException
CqlOperationsexecute in interface CqlOperationsDataAccessExceptionpublic void execute(com.datastax.driver.core.querybuilder.Insert insert)
throws DataAccessException
CqlOperationsexecute in interface CqlOperationsDataAccessExceptionpublic void execute(com.datastax.driver.core.querybuilder.Update update)
throws DataAccessException
CqlOperationsexecute in interface CqlOperationsDataAccessExceptionpublic void execute(com.datastax.driver.core.querybuilder.Batch batch)
throws DataAccessException
CqlOperationsexecute in interface CqlOperationsDataAccessExceptionpublic void execute(com.datastax.driver.core.querybuilder.Truncate truncate)
throws DataAccessException
CqlOperationsexecute in interface CqlOperationsDataAccessExceptionpublic long count(CqlIdentifier tableName)
CqlOperationscount in interface CqlOperationspublic long count(String tableName)
CqlOperationscount in interface CqlOperationsprotected long selectCount(com.datastax.driver.core.querybuilder.Select select)
public com.datastax.driver.core.ResultSetFuture executeAsynchronously(com.datastax.driver.core.querybuilder.Truncate truncate)
throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationsResultSetFuture that can be used to cancel the query.DataAccessExceptionpublic com.datastax.driver.core.ResultSetFuture executeAsynchronously(com.datastax.driver.core.querybuilder.Delete delete)
throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationsResultSetFuture that can be used to cancel the query.DataAccessExceptionpublic com.datastax.driver.core.ResultSetFuture executeAsynchronously(com.datastax.driver.core.querybuilder.Insert insert)
throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationsResultSetFuture that can be used to cancel the query.DataAccessExceptionpublic com.datastax.driver.core.ResultSetFuture executeAsynchronously(com.datastax.driver.core.querybuilder.Update update)
throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationsResultSetFuture that can be used to cancel the query.DataAccessExceptionpublic com.datastax.driver.core.ResultSetFuture executeAsynchronously(com.datastax.driver.core.querybuilder.Batch batch)
throws DataAccessException
CqlOperationsexecuteAsynchronously in interface CqlOperationsResultSetFuture that can be used to cancel the query.DataAccessExceptionpublic Cancellable executeAsynchronously(com.datastax.driver.core.querybuilder.Truncate truncate, AsynchronousQueryListener listener) throws DataAccessException
executeAsynchronously in interface CqlOperationsDataAccessExceptionpublic Cancellable executeAsynchronously(com.datastax.driver.core.querybuilder.Delete delete, AsynchronousQueryListener listener) throws DataAccessException
executeAsynchronously in interface CqlOperationsDataAccessExceptionpublic Cancellable executeAsynchronously(com.datastax.driver.core.querybuilder.Insert insert, AsynchronousQueryListener listener) throws DataAccessException
executeAsynchronously in interface CqlOperationsDataAccessExceptionpublic Cancellable executeAsynchronously(com.datastax.driver.core.querybuilder.Update update, AsynchronousQueryListener listener) throws DataAccessException
executeAsynchronously in interface CqlOperationsDataAccessExceptionpublic Cancellable executeAsynchronously(com.datastax.driver.core.querybuilder.Batch batch, AsynchronousQueryListener listener) throws DataAccessException
executeAsynchronously in interface CqlOperationsDataAccessExceptionpublic com.datastax.driver.core.ResultSetFuture queryAsynchronously(com.datastax.driver.core.querybuilder.Select select)
CqlOperationsqueryAsynchronously in interface CqlOperationspublic Cancellable queryAsynchronously(com.datastax.driver.core.querybuilder.Select select, Runnable listener)
CqlOperationsRunnable, which is started after the query has
completed.
A more useful method than this one is CqlOperations.queryAsynchronously(Select, AsynchronousQueryListener), where you're
given the ResultSetFuture after the query has been executed.queryAsynchronously in interface CqlOperationsselect - The Select Querylistener - Runnable listener for handling the query in a separate threadCancellable that can be used to cancel the query.CqlOperations.queryAsynchronously(Select, AsynchronousQueryListener)public Cancellable queryAsynchronously(com.datastax.driver.core.querybuilder.Select select, AsynchronousQueryListener listener)
CqlOperationsRunnable. The AsynchronousQueryListener gives you access to the ResultSetFuture once the
query is completed for optimal flexibility.queryAsynchronously in interface CqlOperationsselect - The Selectlistener - AsynchronousQueryListener for handling the query's ResultSetFuture in a separate
threadCancellable that can be used to cancel the query.public Cancellable queryAsynchronously(com.datastax.driver.core.querybuilder.Select select, AsynchronousQueryListener listener, Executor executor)
CqlOperationsAsynchronousQueryListener gives you access to the ResultSetFuture
once the query is completed for optimal flexibility.queryAsynchronously in interface CqlOperationsselect - The Select Querylistener - Runnable Listener for handling the query in a separate threadexecutor - To execute the Runnable ListenerCancellable that can be used to cancel the query.public Cancellable queryAsynchronously(com.datastax.driver.core.querybuilder.Select select, Runnable listener, Executor executor)
CqlOperationsqueryAsynchronously in interface CqlOperationsselect - The Select Querylistener - Runnable Listener for handling the query in a separate threadexecutor - To execute the Runnable ListenerCancellable that can be used to cancel the query.public com.datastax.driver.core.ResultSet query(com.datastax.driver.core.querybuilder.Select select)
CqlOperationsResultSet.query in interface CqlOperationsselect - The Select QueryResultSetpublic <T> T query(com.datastax.driver.core.querybuilder.Select select,
ResultSetExtractor<T> rse)
throws DataAccessException
CqlOperationsquery in interface CqlOperationsselect - The SelectQueryrse - The implementation for extracting the ResultSetDataAccessExceptionpublic void query(com.datastax.driver.core.querybuilder.Select select,
RowCallbackHandler rch)
throws DataAccessException
CqlOperationsRowCallbackHandler.query in interface CqlOperationsselect - The Select Queryrch - The implementation for processing the rows returned.DataAccessExceptionpublic <T> List<T> query(com.datastax.driver.core.querybuilder.Select select, RowMapper<T> rowMapper) throws DataAccessException
CqlOperationsquery in interface CqlOperationsselect - The Select QueryrowMapper - The implementation for mapping all rowsDataAccessExceptionpublic <T> T queryForObject(com.datastax.driver.core.querybuilder.Select select,
RowMapper<T> rowMapper)
throws DataAccessException
CqlOperationsThis expects only ONE row to be returned. More than one Row will cause an Exception to be thrown.
queryForObject in interface CqlOperationsselect - The Select QueryrowMapper - The implementation for convert the Row to DataAccessExceptionpublic <T> T queryForObject(com.datastax.driver.core.querybuilder.Select select,
Class<T> requiredType)
throws DataAccessException
CqlOperationsqueryForObject in interface CqlOperationsselect - The Select QueryrequiredType - Valid Class that Cassandra Data Types can be converted to.DataAccessExceptionpublic Map<String,Object> queryForMap(com.datastax.driver.core.querybuilder.Select select) throws DataAccessException
CqlOperationsqueryForMap in interface CqlOperationsselect - The Select QueryDataAccessExceptionpublic <T> List<T> queryForList(com.datastax.driver.core.querybuilder.Select select, Class<T> elementType) throws DataAccessException
CqlOperationsqueryForList in interface CqlOperationsselect - The Select QueryelementType - Type to cast the data values toDataAccessExceptionpublic List<Map<String,Object>> queryForListOfMap(com.datastax.driver.core.querybuilder.Select select) throws DataAccessException
CqlOperationsqueryForListOfMap in interface CqlOperationsselect - The Select QueryDataAccessExceptionpublic <T> Cancellable queryForListAsynchronously(com.datastax.driver.core.querybuilder.Select select, Class<T> elementType, QueryForListListener<T> listener) throws DataAccessException
CqlOperationsSelect query asynchronously and returns all values in the first column of the results
as a List of the type in the second argument.queryForListAsynchronously in interface CqlOperationsselect - The Select queryelementType - The type to cast the data values tolistener - The listener to receive the results asynchronously. Must not be null.Cancellable to cancel the query if necessaryDataAccessExceptionpublic <T> Cancellable queryForListAsynchronously(String select, Class<T> elementType, QueryForListListener<T> listener) throws DataAccessException
CqlOperationsSelect query asynchronously and returns all values in the first column of the results
as a List of the type in the second argument.queryForListAsynchronously in interface CqlOperationsselect - The select query CQLelementType - The type to cast the data values tolistener - The listener to receive the results asynchronously. Must not be null.Cancellable to cancel the query if necessaryDataAccessExceptionpublic Cancellable queryForListOfMapAsynchronously(com.datastax.driver.core.querybuilder.Select select, QueryForListListener<Map<String,Object>> listener) throws DataAccessException
CqlOperationsSelect query and converts the results to a List of Maps. Each element
in the List represents a row returned from the query. Each row's column(s) are put into a Map as
values keyed by column name.queryForListOfMapAsynchronously in interface CqlOperationsselect - The Select query. Must not be null.listener - The listener that will receive the results upon query completion. Must not be null.Cancellable that can be used to cancel the query. Must not be null.DataAccessExceptionpublic Cancellable queryForListOfMapAsynchronously(String cql, QueryForListListener<Map<String,Object>> listener) throws DataAccessException
CqlOperationsList of Maps. Each element in
the List represents a row returned from the query. Each row's column(s) are put into a Map as
values keyed by column name.queryForListOfMapAsynchronously in interface CqlOperationslistener - The listener that will receive the results upon query completion. Must not be null.Cancellable that can be used to cancel the query. Must not be null.DataAccessExceptionpublic Cancellable queryForListOfMapAsynchronously(String cql, QueryForListListener<Map<String,Object>> listener, QueryOptions options) throws DataAccessException
CqlOperationsList of Maps. Each element in
the List represents a row returned from the query. Each row's column(s) are put into a Map as
values keyed by column name.queryForListOfMapAsynchronously in interface CqlOperationslistener - The listener that will receive the results upon query completion. Must not be null.options - The QueryOptions to use. May be null.Cancellable that can be used to cancel the query. Must not be null.DataAccessExceptionpublic Cancellable queryForMapAsynchronously(String cql, QueryForMapListener listener) throws DataAccessException
CqlOperationsMap<String,Object>.
Additional rows are ignored.queryForMapAsynchronously in interface CqlOperationscql - The select query CQL. Must not be null or blank.listener - The QueryForMapListener that will recieve the results upon query completion. Must not be
null.Cancellable that can be used to cancel the query if necessary. Must not be null.DataAccessExceptionpublic Cancellable queryForMapAsynchronously(String cql, QueryForMapListener listener, QueryOptions options) throws DataAccessException
CqlOperationsMap<String,Object>.
Additional rows are ignored.queryForMapAsynchronously in interface CqlOperationscql - The select query CQL. Must not be null or blank.listener - The QueryForMapListener that will recieve the results upon query completion. Must not be
null.options - The QueryOptions to use. May be null.Cancellable that can be used to cancel the query if necessary. Must not be null.DataAccessExceptionpublic Cancellable queryForMapAsynchronously(com.datastax.driver.core.querybuilder.Select select, QueryForMapListener listener) throws DataAccessException
CqlOperationsSelect query asynchronously and maps the first row to a Map
<String,Object>. Additional rows are ignored.queryForMapAsynchronously in interface CqlOperationslistener - The QueryForMapListener that will recieve the results upon query completion. Must not be
null.Cancellable that can be used to cancel the query if necessary. Must not be null.DataAccessExceptionpublic <T> Cancellable queryForObjectAsynchronously(com.datastax.driver.core.querybuilder.Select select, Class<T> requiredType, QueryForObjectListener<T> listener) throws DataAccessException
CqlOperationsSelect query and returns the first column of the first Row as an object of type
T.queryForObjectAsynchronously in interface CqlOperationsselect - The Select queryrequiredType - Type that Cassandra data types can be converted to.Cancellable that can be used to cancel the query if necessary.DataAccessExceptionpublic <T> Cancellable queryForObjectAsynchronously(String cql, Class<T> requiredType, QueryForObjectListener<T> listener) throws DataAccessException
CqlOperationsT.queryForObjectAsynchronously in interface CqlOperationscql - The select query CQL. Must not be null or blank.requiredType - The type to convert the first column of the first row to. Must not be null.Cancellable that can be used to cancel the query if necessary. Must not be null.DataAccessExceptionpublic <T> Cancellable queryForObjectAsynchronously(String cql, Class<T> requiredType, QueryForObjectListener<T> listener, QueryOptions options) throws DataAccessException
CqlOperationsT.queryForObjectAsynchronously in interface CqlOperationscql - The select query CQL. Must not be null or blank.requiredType - The type to convert the first column of the first row to. Must not be null.options - The QueryOptions to use. May be null.Cancellable that can be used to cancel the query if necessary. Must not be null.DataAccessExceptionpublic <T> Cancellable queryForObjectAsynchronously(String cql, RowMapper<T> rowMapper, QueryForObjectListener<T> listener) throws DataAccessException
CqlOperationsRowMapper.queryForObjectAsynchronously in interface CqlOperationscql - The string query CQL.rowMapper - The RowMapper to convert the row into an object of type T.listener - The listener that receives the results upon completion.Cancellable that can be used to cancel the query.DataAccessExceptionpublic <T> Cancellable queryForObjectAsynchronously(String cql, RowMapper<T> rowMapper, QueryForObjectListener<T> listener, QueryOptions options) throws DataAccessException
CqlOperationsRowMapper.queryForObjectAsynchronously in interface CqlOperationscql - The string query CQL.rowMapper - The RowMapper to convert the row into an object of type T.listener - The listener that receives the results upon completion.options - The QueryOptions to use. May be null.Cancellable that can be used to cancel the query.DataAccessExceptionpublic <T> Cancellable queryForObjectAsynchronously(com.datastax.driver.core.querybuilder.Select select, RowMapper<T> rowMapper, QueryForObjectListener<T> listener) throws DataAccessException
CqlOperationsSelect query, and maps the first row returned with the supplied RowMapper.queryForObjectAsynchronously in interface CqlOperationsselect - The Select query to execute.rowMapper - The RowMapper to convert the row into an object of type T.listener - The listener that receives the results upon completion.Cancellable that can be used to cancel the query.DataAccessExceptionpublic com.datastax.driver.core.ResultSet getResultSetUninterruptibly(com.datastax.driver.core.ResultSetFuture rsf)
CqlOperationsResultSetFuture.getUninterruptibly() but translates exceptions if any
are thrown.getResultSetUninterruptibly in interface CqlOperationsrsf - The ResultSetFuture from which to get the ResultSet.ResultSetpublic com.datastax.driver.core.ResultSet getResultSetUninterruptibly(com.datastax.driver.core.ResultSetFuture rsf,
long millis)
CqlOperationsResultSetFuture.getUninterruptibly() but translates exceptions if any
are thrown.getResultSetUninterruptibly in interface CqlOperationsrsf - The ResultSetFuture from which to get the ResultSet.ResultSetpublic com.datastax.driver.core.ResultSet getResultSetUninterruptibly(com.datastax.driver.core.ResultSetFuture rsf,
long timeout,
TimeUnit unit)
CqlOperationsResultSetFuture.getUninterruptibly() but translates exceptions if any
are thrown.getResultSetUninterruptibly in interface CqlOperationsrsf - The ResultSetFuture from which to get the ResultSet.timeout - The timeout to wait. A nonpositive value means wait indefinitely.unit - The TimeUnit of the timeout.ResultSetCopyright © 2011-2015–2015 Pivotal Software, Inc.. All rights reserved.