Class CachedPreparedStatementCreator

java.lang.Object
org.springframework.data.cassandra.core.cql.CachedPreparedStatementCreator
All Implemented Interfaces:
PreparedStatementCreator

@Deprecated public class CachedPreparedStatementCreator extends Object implements PreparedStatementCreator
Deprecated.
since 2.0. This class uses an unsafe, static held cache.
This PreparedStatementCreator maintains a static cache of all prepared statements for the duration of the JVM runtime, more specific the lifecycle of the associated ClassLoader. When preparing statements with Cassandra, each Statement should be prepared once and only once due to the overhead of preparing the statement.

CachedPreparedStatementCreator is thread-safe and does not require external synchronization when used by concurrent threads.

Author:
David Webb, Mark Paluch
  • Field Details

    • log

      protected final Log log
      Deprecated.
  • Constructor Details

    • CachedPreparedStatementCreator

      public CachedPreparedStatementCreator(String cql)
      Deprecated.
      Create a PreparedStatementCreator from the provided CQL.
      Parameters:
      cql - must not be empty or null.
  • Method Details

    • getCql

      public String getCql()
      Deprecated.
      Returns the CQL statement on which the PreparedStatement will be based.
      Returns:
      a String containing the CQL of the PreparedStatement.
    • 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
      Deprecated.
      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.