Class CassandraBoundStatementFactory

java.lang.Object
org.synchronoss.cpo.core.CpoStatementFactory
org.synchronoss.cpo.cassandra.CassandraBoundStatementFactory
All Implemented Interfaces:
CpoReleasable

public class CassandraBoundStatementFactory extends CpoStatementFactory implements 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 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 Cassandra BoundStatement that 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 transaction
      criteria - The object that will be used to look up the cpo metadata
      function - The CpoFunction that is being executed
      bean - The bean that is being acted upon
      wheres - A collection of wheres to find the object
      orderBy - A collection of orderbys to sort the objects
      nativeQueries - 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

      public void setBindValues(Collection<BindAttribute> bindValues) throws CpoException
      Binds every value in a single call, rather than one call per bind variable. Overridden from CpoStatementFactory.setBindValues(java.util.Collection<org.synchronoss.cpo.core.BindAttribute>) because driver 4.x's BoundStatement is immutable -- every individual setXxx(index, value) call returns a new instance instead of mutating in place -- so building the full value array once and calling PreparedStatement.bind(Object...) is both simpler and avoids that pitfall entirely.
      Overrides:
      setBindValues in class CpoStatementFactory
      Parameters:
      bindValues - the bind values to apply to the underlying statement, in parameter order; null is 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