Class CassandraTemplate.PreparedStatementHandler

java.lang.Object
org.springframework.data.cassandra.core.CassandraTemplate.PreparedStatementHandler
All Implemented Interfaces:
CqlProvider, PreparedStatementBinder, PreparedStatementCreator
Enclosing class:
CassandraTemplate

public static class CassandraTemplate.PreparedStatementHandler extends Object implements PreparedStatementCreator, PreparedStatementBinder, CqlProvider
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)
     
  • 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.
    com.datastax.oss.driver.api.core.cql.PreparedStatement
    createPreparedStatement(com.datastax.oss.driver.api.core.CqlSession session)
    Create a statement in this session.
    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)
  • Method Details

    • createPreparedStatement

      public 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: PreparedStatementCreator
      Create a statement in this session. Allows implementations to use PreparedStatement.
      Specified by:
      createPreparedStatement in interface PreparedStatementCreator
      Parameters:
      session - CqlSession to use to create statement.
      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 CqlTemplate class will handle them.
    • 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.