public class CachedPreparedStatementCreator extends Object implements PreparedStatementCreator
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.
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
log |
| Constructor and Description |
|---|
CachedPreparedStatementCreator(String cql)
Create a
PreparedStatementCreator from the provided CQL. |
| Modifier and Type | Method and Description |
|---|---|
com.datastax.driver.core.PreparedStatement |
createPreparedStatement(com.datastax.driver.core.Session session)
Create a statement in this session.
|
String |
getCql()
Returns the CQL statement on which the
PreparedStatement will be based. |
public CachedPreparedStatementCreator(String cql)
PreparedStatementCreator from the provided CQL.cql - must not be empty or null.public String getCql()
PreparedStatement will be based.PreparedStatement.public com.datastax.driver.core.PreparedStatement createPreparedStatement(com.datastax.driver.core.Session session)
throws com.datastax.driver.core.exceptions.DriverException
PreparedStatementCreatorcreatePreparedStatement in interface PreparedStatementCreatorsession - Session to use to create statementcom.datastax.driver.core.exceptions.DriverException - there is no need to catch DriverException that may be thrown in the implementation of this
method. The CassandraTemlate class will handle them.Copyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.