org.synchronoss.cpo.jdbc
Class JdbcPreparedStatementFactory

Package class diagram package JdbcPreparedStatementFactory
java.lang.Object
  extended by org.synchronoss.cpo.jdbc.JdbcPreparedStatementFactory
All Implemented Interfaces:
CpoReleasible

public class JdbcPreparedStatementFactory
extends java.lang.Object
implements CpoReleasible

JdbcPreparedStatementFactory is the object that encapsulates the creation of the actual PreparedStatement for the JDBC driver.


Constructor Summary
JdbcPreparedStatementFactory(java.sql.Connection conn, JdbcCpoAdapter jca, JdbcMetaClass<T> jmcCriteria, JdbcQuery jq, T obj)
          Used to build the PreparedStatement that is used by CPO to create the actual JDBC PreparedStatement.
JdbcPreparedStatementFactory(java.sql.Connection conn, JdbcCpoAdapter jca, JdbcMetaClass<T> jmcCriteria, JdbcQuery jq, T obj, CpoWhere where, java.util.Collection<CpoOrderBy> orderBy)
          Used to build the PreparedStatement that is used by CPO to create the actual JDBC PreparedStatement.
JdbcPreparedStatementFactory(java.sql.Connection conn, JdbcCpoAdapter jca, JdbcMetaClass<T> jmcCriteria, JdbcQuery jq, T obj, CpoWhere where, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<BindAttribute> bindValues)
          Used to build the PreparedStatement that is used by CPO to create the actual JDBC PreparedStatement.
 
Method Summary
 void AddReleasible(CpoReleasible releasible)
          Adds a releasible object to this object.
 void bindParameters(java.lang.Object obj)
          Called by the CPO Framework.
protected  java.util.Collection<BindAttribute> getBindValues()
           
protected  JdbcQuery getJdbcQuery()
           
 java.sql.PreparedStatement getPreparedStatement()
          Returns the jdbc prepared statment associated with this object
 void release()
          Called by the CPO framework.
protected  java.lang.StringBuffer replaceMarker(java.lang.StringBuffer source, java.lang.String marker, java.lang.String replace)
           
protected  void setBindValues(java.util.Collection<BindAttribute> bindValues_)
           
protected  void setJdbcQuery(JdbcQuery jq_)
           
protected  void setPreparedStatement(java.sql.PreparedStatement ps)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcPreparedStatementFactory

public JdbcPreparedStatementFactory(java.sql.Connection conn,
                                    JdbcCpoAdapter jca,
                                    JdbcMetaClass<T> jmcCriteria,
                                    JdbcQuery jq,
                                    T obj)
                             throws CpoException
Used to build the PreparedStatement that is used by CPO to create the actual JDBC PreparedStatement. 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 connection.

Parameters:
conn - The actual jdbc connection that will be used to create the callable statement.
jca - The JdbcCpoAdapter that is controlling this transaction
jq - The JdbcQuery that is being executed
obj - The pojo that is being acted upon
Throws:
CpoException - if a CPO error occurs
java.sql.SQLException - if a JDBC error occurs

JdbcPreparedStatementFactory

public JdbcPreparedStatementFactory(java.sql.Connection conn,
                                    JdbcCpoAdapter jca,
                                    JdbcMetaClass<T> jmcCriteria,
                                    JdbcQuery jq,
                                    T obj,
                                    CpoWhere where,
                                    java.util.Collection<CpoOrderBy> orderBy)
                             throws CpoException
Used to build the PreparedStatement that is used by CPO to create the actual JDBC PreparedStatement. 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 connection.

Parameters:
conn - The actual jdbc connection that will be used to create the callable statement.
jca - The JdbcCpoAdapter that is controlling this transaction
jq - The JdbcQuery that is being executed
obj - The pojo that is being acted upon
where - a cpoWhere to be added to the queryText from the query group
orderBy - an orderBy to be added to the queryText from the query group
Throws:
CpoException - if a CPO error occurs
java.sql.SQLException - if a JDBC error occurs

JdbcPreparedStatementFactory

public JdbcPreparedStatementFactory(java.sql.Connection conn,
                                    JdbcCpoAdapter jca,
                                    JdbcMetaClass<T> jmcCriteria,
                                    JdbcQuery jq,
                                    T obj,
                                    CpoWhere where,
                                    java.util.Collection<CpoOrderBy> orderBy,
                                    java.util.Collection<BindAttribute> bindValues)
                             throws CpoException
Used to build the PreparedStatement that is used by CPO to create the actual JDBC PreparedStatement. 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 connection.

Parameters:
conn - The actual jdbc connection that will be used to create the callable statement.
jca - The JdbcCpoAdapter that is controlling this transaction
jq - The JdbcQuery that is being executed
obj - The pojo that is being acted upon
additionalSql - Additional sql to be appended to the JdbcQuery sql that is used to create the actual JDBC PreparedStatement
bindValues - additional bind values from a dynamic where statement
Throws:
CpoException - if a CPO error occurs
java.sql.SQLException - if a JDBC error occurs
Method Detail

replaceMarker

protected java.lang.StringBuffer replaceMarker(java.lang.StringBuffer source,
                                               java.lang.String marker,
                                               java.lang.String replace)

getPreparedStatement

public java.sql.PreparedStatement getPreparedStatement()
Returns the jdbc prepared statment associated with this object


setPreparedStatement

protected void setPreparedStatement(java.sql.PreparedStatement ps)

AddReleasible

public void AddReleasible(CpoReleasible releasible)
Adds a releasible object to this object. The release method on the releasible will be called when the PreparedStatement is executed.


release

public void release()
             throws CpoException
Called by the CPO framework. This method calls the release on all the CpoReleasible associated with this object

Specified by:
release in interface CpoReleasible
Throws:
CpoException

bindParameters

public void bindParameters(java.lang.Object obj)
                    throws CpoException
Called by the CPO Framework. Binds all the attibutes from the class for the CPO meta parameters and the parameters from the dynamic where.

Throws:
CpoException

getBindValues

protected java.util.Collection<BindAttribute> getBindValues()
Returns:
Returns the bindValues_.

setBindValues

protected void setBindValues(java.util.Collection<BindAttribute> bindValues_)
Parameters:
bindValues_ - The bindValues_ to set.

getJdbcQuery

protected JdbcQuery getJdbcQuery()
Returns:
Returns the jq_.

setJdbcQuery

protected void setJdbcQuery(JdbcQuery jq_)
Parameters:
jq_ - The jq_ to set.