Class AsyncCassandraTemplate.PreparedStatementHandler

java.lang.Object
org.springframework.data.cassandra.core.AsyncCassandraTemplate.PreparedStatementHandler
All Implemented Interfaces:
AsyncCassandraTemplate.AsyncPreparedStatementHandler, AsyncPreparedStatementCreator, CqlProvider, PreparedStatementBinder
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

    Constructors
    Constructor
    Description
    PreparedStatementHandler(com.datastax.oss.driver.api.core.cql.Statement<?> statement, PersistenceExceptionTranslator exceptionTranslator)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.datastax.oss.driver.api.core.cql.BoundStatement
    bindValues(com.datastax.oss.driver.api.core.cql.PreparedStatement ps)
    Bind parameter values on the given PreparedStatement.
    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.
    Return the CQL string for this object, i.e. typically the CQL used for creating statements.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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: AsyncPreparedStatementCreator
      Create a statement in this session. Allows implementations to use PreparedStatements. The CqlTemplate will attempt to cache the PreparedStatements for future use without the overhead of re-preparing on the entire cluster.
      Specified by:
      createPreparedStatement in interface AsyncPreparedStatementCreator
      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. The AsyncCqlTemplate class 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: PreparedStatementBinder
      Bind parameter values on the given PreparedStatement.
      Specified by:
      bindValues in interface PreparedStatementBinder
      Parameters:
      ps - the PreparedStatement to invoke setter methods on.
      Throws:
      com.datastax.oss.driver.api.core.DriverException - if a DriverException is encountered (i.e. there is no need to catch DriverException)
    • getCql

      public String getCql()
      Description copied from interface: CqlProvider
      Return the CQL string for this object, i.e. typically the CQL used for creating statements.
      Specified by:
      getCql in interface CqlProvider
      Returns:
      the CQL string.