Class AsyncCassandraTemplate.PreparedStatementHandler
java.lang.Object
org.springframework.data.cassandra.core.legacy.AsyncCassandraTemplate.PreparedStatementHandler
- All Implemented Interfaces:
CqlProvider,AsyncPreparedStatementCreator,PreparedStatementBinder,AsyncCassandraTemplate.AsyncPreparedStatementHandler
- Enclosing class:
- AsyncCassandraTemplate
public static class AsyncCassandraTemplate.PreparedStatementHandler
extends Object
implements AsyncCassandraTemplate.AsyncPreparedStatementHandler
Utility class to prepare a
SimpleStatement and bind values associated with the statement to a
BoundStatement.- Since:
- 3.2
-
Constructor Summary
ConstructorsConstructorDescriptionPreparedStatementHandler(com.datastax.oss.driver.api.core.cql.Statement<?> statement, PersistenceExceptionTranslator exceptionTranslator) -
Method Summary
Modifier and TypeMethodDescriptioncom.datastax.oss.driver.api.core.cql.BoundStatementbindValues(com.datastax.oss.driver.api.core.cql.PreparedStatement ps) Bind parameter values on the givenPreparedStatement.ListenableFuture<com.datastax.oss.driver.api.core.cql.PreparedStatement>createPreparedStatement(com.datastax.oss.driver.api.core.CqlSession session) Create a statement in this session.protected CompletionStage<com.datastax.oss.driver.api.core.cql.PreparedStatement>doPrepare(com.datastax.oss.driver.api.core.CqlSession session) Invokes the statement preparation.getCql()Return the CQL string for this object, i.e. typically the CQL used for creating statements.
-
Constructor Details
-
PreparedStatementHandler
public PreparedStatementHandler(com.datastax.oss.driver.api.core.cql.Statement<?> statement, PersistenceExceptionTranslator exceptionTranslator)
-
-
Method Details
-
createPreparedStatement
public ListenableFuture<com.datastax.oss.driver.api.core.cql.PreparedStatement> createPreparedStatement(com.datastax.oss.driver.api.core.CqlSession session) throws com.datastax.oss.driver.api.core.DriverException Description copied from interface:AsyncPreparedStatementCreatorCreate a statement in this session. Allows implementations to usePreparedStatements. TheCqlTemplatewill attempt to cache thePreparedStatements for future use without the overhead of re-preparing on the entire cluster.- Specified by:
createPreparedStatementin interfaceAsyncPreparedStatementCreator- Parameters:
session- Session to use to create statement, must not be null.- Returns:
- a prepared statement.
- Throws:
com.datastax.oss.driver.api.core.DriverException- there is no need to catch DriverException that may be thrown in the implementation of this method. TheAsyncCqlTemplateclass will handle them.
-
doPrepare
protected CompletionStage<com.datastax.oss.driver.api.core.cql.PreparedStatement> doPrepare(com.datastax.oss.driver.api.core.CqlSession session) Invokes the statement preparation.- Parameters:
session-- Returns:
-
bindValues
public com.datastax.oss.driver.api.core.cql.BoundStatement bindValues(com.datastax.oss.driver.api.core.cql.PreparedStatement ps) throws com.datastax.oss.driver.api.core.DriverException Description copied from interface:PreparedStatementBinderBind parameter values on the givenPreparedStatement.- Specified by:
bindValuesin interfacePreparedStatementBinder- Parameters:
ps- the PreparedStatement to invoke setter methods on.- Throws:
com.datastax.oss.driver.api.core.DriverException- if aDriverExceptionis encountered (i.e. there is no need to catchDriverException)
-
getCql
Description copied from interface:CqlProviderReturn the CQL string for this object, i.e. typically the CQL used for creating statements.- Specified by:
getCqlin interfaceCqlProvider- Returns:
- the CQL string.
-