Package org.synchronoss.cpo.cassandra
Class CassandraBoundStatementFactory
java.lang.Object
org.synchronoss.cpo.core.CpoStatementFactory
org.synchronoss.cpo.cassandra.CassandraBoundStatementFactory
- All Implemented Interfaces:
CpoReleasable
CassandraBoundStatementFactory is the object that encapsulates the creation of the actual
Cassandra
BoundStatement used to execute a CpoFunction against the datastax driver.- Author:
- david berry
-
Constructor Summary
ConstructorsConstructorDescriptionCassandraBoundStatementFactory(com.datastax.oss.driver.api.core.CqlSession sess, CassandraCpoAdapter cassandraCpoAdapter, CpoClass criteria, CpoFunction function, T bean, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeQueries) Used to build the CassandraBoundStatementthat CPO executes for a given CpoFunction. -
Method Summary
Modifier and TypeMethodDescriptioncom.datastax.oss.driver.api.core.cql.BoundStatementGets the BoundStatent associated with this factoryvoidsetBindValues(Collection<BindAttribute> bindValues) Binds every value in a single call, rather than one call per bind variable.Methods inherited from class org.synchronoss.cpo.core.CpoStatementFactory
AddReleasable, getBindValues, getLocalLogger, releaseMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.synchronoss.cpo.core.CpoReleasable
release
-
Constructor Details
-
CassandraBoundStatementFactory
public CassandraBoundStatementFactory(com.datastax.oss.driver.api.core.CqlSession sess, CassandraCpoAdapter cassandraCpoAdapter, CpoClass criteria, CpoFunction function, T bean, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeQueries) throws CpoException Used to build the CassandraBoundStatementthat CPO executes for a given CpoFunction. The constructor is called by the internal CPO framework. This is not to be used by users of CPO. Programmers that build Transforms may need to use this object to get access to the actual bound statement.- Type Parameters:
T- The type of the object being bound- Parameters:
sess- The Cassandra session that will be used to prepare and bind the statement.cassandraCpoAdapter- The CassandraCpoAdapter that is controlling this transactioncriteria- The object that will be used to look up the cpo metadatafunction- The CpoFunction that is being executedbean- The bean that is being acted uponwheres- A collection of wheres to find the objectorderBy- A collection of orderbys to sort the objectsnativeQueries- Additional CQL to be embedded into the CpoFunction CQL that is used to create the actual Cassandra BoundStatement- Throws:
CpoException- if a CPO error occurs
-
-
Method Details
-
setBindValues
Binds every value in a single call, rather than one call per bind variable. Overridden fromCpoStatementFactory.setBindValues(java.util.Collection<org.synchronoss.cpo.core.BindAttribute>)because driver 4.x'sBoundStatementis immutable -- every individualsetXxx(index, value)call returns a new instance instead of mutating in place -- so building the full value array once and callingPreparedStatement.bind(Object...)is both simpler and avoids that pitfall entirely.- Overrides:
setBindValuesin classCpoStatementFactory- Parameters:
bindValues- the bind values to apply to the underlying statement, in parameter order;nullis treated as no bind values- Throws:
CpoException- if a value could not be resolved for binding
-
getBoundStatement
public com.datastax.oss.driver.api.core.cql.BoundStatement getBoundStatement()Gets the BoundStatent associated with this factory- Returns:
- The BoundStatement
-