org.synchronoss.cpo.jdbc
Class JdbcCpoAdapter

Package class diagram package JdbcCpoAdapter
java.lang.Object
  extended by org.synchronoss.cpo.jdbc.JdbcCpoAdapter
All Implemented Interfaces:
java.io.Serializable, CpoAdapter
Direct Known Subclasses:
JdbcCpoTrxAdapter

public class JdbcCpoAdapter
extends java.lang.Object
implements CpoAdapter

JdbcCpoAdapter is an interface for a set of routines that are responsible for managing value objects from a datasource.

Author:
david berry
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.synchronoss.cpo.CpoAdapter
CREATE, DELETE, EXECUTE, EXIST, INSERT, LIST, PERSIST, RETRIEVE, UPDATE
 
Constructor Summary
protected JdbcCpoAdapter()
           
protected JdbcCpoAdapter(javax.sql.DataSource metaSource, java.lang.String metaSourceName, boolean batchSupported, java.lang.String dbTablePrefix)
           
  JdbcCpoAdapter(JdbcDataSourceInfo jdsi)
          Creates a JdbcCpoAdapter.
  JdbcCpoAdapter(JdbcDataSourceInfo jdsiMeta, JdbcDataSourceInfo jdsiTrx)
          Creates a JdbcCpoAdapter.
  JdbcCpoAdapter(JdbcDataSourceInfo jdsiMeta, JdbcDataSourceInfo jdsiWrite, JdbcDataSourceInfo jdsiRead)
          Creates a JdbcCpoAdapter.
 
Method Summary
protected  void clearConnectionBusy(java.sql.Connection c)
           
 void clearMetaClass()
          Clears the metadata for all classes for the current datasource.
 void clearMetaClass(boolean all)
          Clears the metadata for all classes.
 void clearMetaClass(java.lang.Object obj)
          Clears the metadata for the specified object.
 void clearMetaClass(java.lang.String className)
          Clears the metadata for the specified fully qualifed class name.
protected  void closeConnection(java.sql.Connection connection)
          DOCUMENT ME!
protected  void commitConnection(java.sql.Connection connection)
          DOCUMENT ME!
<T> long
deleteObject(java.lang.String name, T obj)
          Removes the Object from the datasource.
<T> long
deleteObject(T obj)
          Removes the Object from the datasource.
<T> long
deleteObjects(java.util.Collection<T> coll)
          Removes the Objects contained in the collection from the datasource.
<T> long
deleteObjects(java.lang.String name, java.util.Collection<T> coll)
          Removes the Objects contained in the collection from the datasource.
<T,C> T
executeObject(java.lang.String name, C criteria, T result)
          Executes an Object that represents an executable object within the datasource.
<T> T
executeObject(java.lang.String name, T object)
          Executes an Object whose metadata will call an executable within the datasource.
<T> T
executeObject(T object)
          Executes an Object whose metadata will call an executable within the datasource.
<T> long
existsObject(java.lang.String name, T obj)
          The CpoAdapter will check to see if this object exists in the datasource.
<T> long
existsObject(java.lang.String name, T obj, java.util.Collection<CpoWhere> wheres)
          The CpoAdapter will check to see if this object exists in the datasource.
protected
<T> long
existsObject(java.lang.String name, T obj, java.sql.Connection con, java.sql.Connection metaCon, java.util.Collection<CpoWhere> wheres)
          The CpoAdapter will check to see if this object exists in the datasource.
<T> long
existsObject(T obj)
          The CpoAdapter will check to see if this object exists in the datasource.
protected  javax.naming.Context getContext()
          DOCUMENT ME!
 CpoTrxAdapter getCpoTrxAdapter()
          Provides a mechanism for the user to obtain a CpoTrxAdapter object.
protected  java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,JdbcMetaClass<?>>> getDataSourceMap()
          DOCUMENT ME!
 java.lang.String getDbTablePrefix()
           
protected
<T> java.lang.String
getGroupType(T obj, java.lang.String type, java.lang.String name, java.sql.Connection c, java.sql.Connection meta)
          DOCUMENT ME!
protected
<T> JdbcMetaClass<T>
getMetaClass(T obj, java.sql.Connection c)
          DOCUMENT ME!
protected  java.util.HashMap<java.lang.String,JdbcMetaClass<?>> getMetaClassMap()
           
protected  java.sql.Connection getMetaConnection()
          DOCUMENT ME!
protected  javax.sql.DataSource getMetaDataSource()
          DOCUMENT ME!
protected  java.lang.String getMetaDataSourceName()
          DOCUMENT ME!
protected  java.sql.Connection getReadConnection()
          DOCUMENT ME!
protected  javax.sql.DataSource getReadDataSource()
          DOCUMENT ME!
protected  java.sql.Connection getStaticConnection()
           
protected  java.sql.Connection getWriteConnection()
          DOCUMENT ME!
protected  javax.sql.DataSource getWriteDataSource()
          DOCUMENT ME!
<T> long
insertObject(java.lang.String name, T obj)
          Creates the Object in the datasource.
<T> long
insertObject(T obj)
          Creates the Object in the datasource.
<T> long
insertObjects(java.util.Collection<T> coll)
          Iterates through a collection of Objects, creates and stores them in the datasource.
<T> long
insertObjects(java.lang.String name, java.util.Collection<T> coll)
          Iterates through a collection of Objects, creates and stores them in the datasource.
protected  boolean isConnectionBusy(java.sql.Connection c)
           
protected  boolean isStaticConnection(java.sql.Connection c)
           
 CpoOrderBy newOrderBy(java.lang.String attribute, boolean ascending)
          newOrderBy allows you to dynamically change the order of the objects in the resulting collection.
 CpoOrderBy newOrderBy(java.lang.String attribute, boolean ascending, java.lang.String function)
          newOrderBy allows you to dynamically change the order of the objects in the resulting collection.
 CpoWhere newWhere()
          DOCUMENT ME!
<T> CpoWhere
newWhere(int logical, java.lang.String attr, int comp, T value)
          DOCUMENT ME!
<T> CpoWhere
newWhere(int logical, java.lang.String attr, int comp, T value, boolean not)
          DOCUMENT ME!
<T> long
persistObject(java.lang.String name, T obj)
          Persists the Object into the datasource.
<T> long
persistObject(T obj)
          Persists the Object into the datasource.
<T> long
persistObjects(java.util.Collection<T> coll)
          Persists a collection of Objects into the datasource.
<T> long
persistObjects(java.lang.String name, java.util.Collection<T> coll)
          Persists a collection of Objects into the datasource.
protected
<T> long
processBatchUpdateGroup(T[] arr, java.lang.String groupType, java.lang.String groupName, java.sql.Connection con, java.sql.Connection metaCon)
          DOCUMENT ME!
protected
<T,C> T
processExecuteGroup(java.lang.String name, C criteria, T result)
          Executes an Object whose MetaData contains a stored procedure.
protected
<T,C> T
processExecuteGroup(java.lang.String name, C criteria, T result, java.sql.Connection conn, java.sql.Connection metaCon)
          DOCUMENT ME!
protected
<T,C> java.util.List<T>
processSelectGroup(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries, boolean useRetrieve)
          DOCUMENT ME!
protected
<T,C> void
processSelectGroup(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries, boolean useRetrieve, CpoResultSet<T> resultSet)
           
protected
<T,C> void
processSelectGroup(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries, java.sql.Connection con, java.sql.Connection metaCon, boolean useRetrieve, CpoResultSet<T> resultSet)
          DOCUMENT ME!
protected
<T> T
processSelectGroup(T obj, java.lang.String groupName)
          Retrieves the Object from the datasource.
protected
<T> T
processSelectGroup(T obj, java.lang.String groupName, java.sql.Connection con, java.sql.Connection metaCon)
          DOCUMENT ME!
protected
<T> long
processUpdateGroup(java.util.Collection<T> coll, java.lang.String groupType, java.lang.String groupName)
          DOCUMENT ME!
protected
<T> long
processUpdateGroup(java.util.Collection<T> coll, java.lang.String groupType, java.lang.String groupName, java.sql.Connection con, java.sql.Connection meta)
          DOCUMENT ME!
protected
<T> long
processUpdateGroup(T obj, java.lang.String groupType, java.lang.String groupName)
          DOCUMENT ME!
protected
<T> long
processUpdateGroup(T obj, java.lang.String groupType, java.lang.String groupName, java.sql.Connection con, java.sql.Connection metaCon)
          DOCUMENT ME!
<T,C> T
retrieveBean(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<T,C> T
retrieveBean(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries)
          Retrieves the bean from the datasource.
<T> T
retrieveBean(java.lang.String name, T bean)
          Retrieves the bean from the datasource.
<T> T
retrieveBean(T bean)
          Retrieves the bean from the datasource.
<C> java.util.List<C>
retrieveBeans(java.lang.String name, C criteria)
          Retrieves the bean from the datasource.
<C> java.util.List<C>
retrieveBeans(java.lang.String name, C criteria, java.util.Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<C> java.util.List<C>
retrieveBeans(java.lang.String name, C criteria, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<C> java.util.List<C>
retrieveBeans(java.lang.String name, C criteria, CpoWhere where, java.util.Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<T,C> java.util.List<T>
retrieveBeans(java.lang.String name, C criteria, T result)
          Retrieves the bean from the datasource.
<T,C> java.util.List<T>
retrieveBeans(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<T,C> java.util.List<T>
retrieveBeans(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries)
          Retrieves the bean from the datasource.
<T,C> CpoResultSet<T>
retrieveBeans(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries, int queueSize)
          Retrieves the bean from the datasource.
<T,C> java.util.List<T>
retrieveBeans(java.lang.String name, C criteria, T result, CpoWhere where, java.util.Collection<CpoOrderBy> orderBy)
          Retrieves the bean from the datasource.
<T,C> T
retrieveObject(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy)
          Deprecated. use retrieveBean
<T,C> T
retrieveObject(java.lang.String name, C criteria, T result, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries)
          Deprecated. use retrieveBean
<T> T
retrieveObject(java.lang.String name, T obj)
          Deprecated. use retrieveBean
<T> T
retrieveObject(T obj)
          Deprecated. use retrieveBean
<T,C> java.util.Collection<T>
retrieveObjects(java.lang.String name, C criteria, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries, T result)
          Deprecated. use retrieveBeans
<T,C> CpoResultSet<T>
retrieveObjects(java.lang.String name, C criteria, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, java.util.Collection<CpoNativeQuery> nativeQueries, T result, int queueSize)
          Deprecated. use retrieveBeans
<T,C> java.util.Collection<T>
retrieveObjects(java.lang.String name, C criteria, java.util.Collection<CpoWhere> wheres, java.util.Collection<CpoOrderBy> orderBy, T result)
          Deprecated. use retrieveBeans
protected  void rollbackConnection(java.sql.Connection connection)
          DOCUMENT ME!
protected  void setConnectionBusy(java.sql.Connection c)
           
protected  void setContext(javax.naming.Context context)
          DOCUMENT ME!
protected  void setDataSourceMap(java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,JdbcMetaClass<?>>> dsMap)
           
 void setDbTablePrefix(java.lang.String dbTablePrefix)
           
protected  void setMetaDataSource(javax.sql.DataSource metaDataSource)
          DOCUMENT ME!
protected  void setMetaDataSourceName(java.lang.String metaDataSourceName)
          DOCUMENT ME!
protected  void setReadDataSource(javax.sql.DataSource readDataSource)
          DOCUMENT ME!
protected  void setStaticConnection(java.sql.Connection c)
           
protected  void setWriteDataSource(javax.sql.DataSource writeDataSource)
          DOCUMENT ME!
<T> long
transactObjects(java.util.Collection<CpoObject<T>> coll)
          Deprecated.  
protected
<T> long
transactObjects(java.util.Collection<CpoObject<T>> coll, java.sql.Connection c, java.sql.Connection meta)
          Deprecated.  
<T> long
updateObject(java.lang.String name, T obj)
          Update the Object in the datasource.
<T> long
updateObject(T obj)
          Update the Object in the datasource.
<T> long
updateObjects(java.util.Collection<T> coll)
          Updates a collection of Objects in the datasource.
<T> long
updateObjects(java.lang.String name, java.util.Collection<T> coll)
          Updates a collection of Objects in the datasource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcCpoAdapter

protected JdbcCpoAdapter()

JdbcCpoAdapter

public JdbcCpoAdapter(JdbcDataSourceInfo jdsi)
               throws CpoException
Creates a JdbcCpoAdapter.

Parameters:
jdsi - This datasource will be used for both the metadata and the transaction database.
Throws:
CpoException - exception

JdbcCpoAdapter

public JdbcCpoAdapter(JdbcDataSourceInfo jdsiMeta,
                      JdbcDataSourceInfo jdsiTrx)
               throws CpoException
Creates a JdbcCpoAdapter.

Parameters:
jdsiMeta - This datasource that identifies the cpo metadata datasource
jdsiTrx - The datasoruce that identifies the transaction database.
Throws:
CpoException - exception

JdbcCpoAdapter

public JdbcCpoAdapter(JdbcDataSourceInfo jdsiMeta,
                      JdbcDataSourceInfo jdsiWrite,
                      JdbcDataSourceInfo jdsiRead)
               throws CpoException
Creates a JdbcCpoAdapter.

Parameters:
jdsiMeta - This datasource that identifies the cpo metadata datasource
jdsiWrite - The datasource that identifies the transaction database for write transactions.
jdsiRead - The datasource that identifies the transaction database for read-only transactions.
Throws:
CpoException - exception

JdbcCpoAdapter

protected JdbcCpoAdapter(javax.sql.DataSource metaSource,
                         java.lang.String metaSourceName,
                         boolean batchSupported,
                         java.lang.String dbTablePrefix)
                  throws CpoException
Throws:
CpoException
Method Detail

clearMetaClass

public void clearMetaClass(java.lang.Object obj)
Clears the metadata for the specified object. The metadata will be reloaded the next time that CPO is called to access this object

Specified by:
clearMetaClass in interface CpoAdapter
Parameters:
obj - The object whose metadata must be cleared

clearMetaClass

public void clearMetaClass(java.lang.String className)
Clears the metadata for the specified fully qualifed class name. The metadata will be reloaded the next time CPO is called to access this class.

Specified by:
clearMetaClass in interface CpoAdapter
Parameters:
className - The fully qualified class name for the class that needs its metadata cleared.

clearMetaClass

public void clearMetaClass(boolean all)
Clears the metadata for all classes. The metadata will be lazy-loaded from the metadata repository as classes are accessed.

Specified by:
clearMetaClass in interface CpoAdapter
Parameters:
all - true - clear all classes for all datasources. false - clear all classes for the current datasource.
Throws:
CpoException - Thrown if there are errors accessing the datasource

clearMetaClass

public void clearMetaClass()
Clears the metadata for all classes for the current datasource. The metadata will be lazy-loaded from the metadata repository as classes are accessed.

Specified by:
clearMetaClass in interface CpoAdapter
Throws:
CpoException - Thrown if there are errors accessing the datasource

insertObject

public <T> long insertObject(T obj)
                  throws CpoException
Creates the Object in the datasource. The assumption is that the object does not exist in the datasource. This method creates and stores the object in the datasource.
Example:
 
 class SomeObject so = new SomeObject();
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                cpo.insertObject(so);
        } catch (CpoException ce) {
                // Handle the error
 
        }
 }

Specified by:
insertObject in interface CpoAdapter
Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects created in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

insertObject

public <T> long insertObject(java.lang.String name,
                             T obj)
                  throws CpoException
Creates the Object in the datasource. The assumption is that the object does not exist in the datasource. This method creates and stores the object in the datasource
Example:
 
 class SomeObject so = new SomeObject();
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                cpo.insertObject("IDNameInsert",so);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
insertObject in interface CpoAdapter
Parameters:
name - The String name of the CREATE Query group that will be used to create the object in the datasource. null signifies that the default rules will be used which is equivalent to insertObject(Object obj);
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects created in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

insertObjects

public <T> long insertObjects(java.util.Collection<T> coll)
                   throws CpoException
Iterates through a collection of Objects, creates and stores them in the datasource. The assumption is that the objects contained in the collection do not exist in the datasource. This method creates and stores the objects in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions. This means that if one of the objects fail being created in the datasource then the CpoAdapter will stop processing the remainder of the collection and rollback all the objects created thus far. Rollback is on the underlying datasource's support of rollback.
Example:
 
 class SomeObject so = null;
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        ArrayList al = new ArrayList();
        for (int i=0; i<3; i++){
                so = new SomeObject();
                so.setId(1);
                so.setName("SomeName");
                al.add(so);
        }
        try{
                cpo.insertObjects(al);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
insertObjects in interface CpoAdapter
Parameters:
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects created in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

insertObjects

public <T> long insertObjects(java.lang.String name,
                              java.util.Collection<T> coll)
                   throws CpoException
Iterates through a collection of Objects, creates and stores them in the datasource. The assumption is that the objects contained in the collection do not exist in the datasource. This method creates and stores the objects in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions. This means that if one of the objects fail being created in the datasource then the CpoAdapter should stop processing the remainder of the collection, and if supported, rollback all the objects created thus far.
Example:
 
 class SomeObject so = null;
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 if (cpo!=null) {
        ArrayList al = new ArrayList();
        for (int i=0; i<3; i++){
                so = new SomeObject();
                so.setId(1);
                so.setName("SomeName");
                al.add(so);
        }
        try{
                cpo.insertObjects("IdNameInsert",al);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
insertObjects in interface CpoAdapter
Parameters:
name - The String name of the CREATE Query group that will be used to create the object in the datasource. null signifies that the default rules will be used.
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects created in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

deleteObject

public <T> long deleteObject(T obj)
                  throws CpoException
Removes the Object from the datasource. The assumption is that the object exists in the datasource. This method stores the object in the datasource
Example:
 
 class SomeObject so = new SomeObject();
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                cpo.deleteObject(so);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
deleteObject in interface CpoAdapter
Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource an exception will be thrown.
Returns:
The number of objects deleted from the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

deleteObject

public <T> long deleteObject(java.lang.String name,
                             T obj)
                  throws CpoException
Removes the Object from the datasource. The assumption is that the object exists in the datasource. This method stores the object in the datasource
Example:
 
 class SomeObject so = new SomeObject();
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                cpo.deleteObject("DeleteById",so);
        } catch (CpoException ce) {
        // Handle the error
        }
 }

Specified by:
deleteObject in interface CpoAdapter
Parameters:
name - The String name of the DELETE Query group that will be used to create the object in the datasource. null signifies that the default rules will be used.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource an exception will be thrown.
Returns:
The number of objects deleted from the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

deleteObjects

public <T> long deleteObjects(java.util.Collection<T> coll)
                   throws CpoException
Removes the Objects contained in the collection from the datasource. The assumption is that the object exists in the datasource. This method stores the objects contained in the collection in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions. This means that if one of the objects fail being deleted in the datasource then the CpoAdapter should stop processing the remainder of the collection, and if supported, rollback all the objects deleted thus far.
Example:
 
 class SomeObject so = null;
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        ArrayList al = new ArrayList();
        for (int i=0; i<3; i++){
                so = new SomeObject();
                so.setId(1);
                so.setName("SomeName");
                al.add(so);
        }
        try{
                cpo.deleteObjects(al);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
deleteObjects in interface CpoAdapter
Parameters:
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects deleted from the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

deleteObjects

public <T> long deleteObjects(java.lang.String name,
                              java.util.Collection<T> coll)
                   throws CpoException
Removes the Objects contained in the collection from the datasource. The assumption is that the object exists in the datasource. This method stores the objects contained in the collection in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions. This means that if one of the objects fail being deleted in the datasource then the CpoAdapter should stop processing the remainder of the collection, and if supported, rollback all the objects deleted thus far.
Example:
 
 class SomeObject so = null;
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        ArrayList al = new ArrayList();
        for (int i=0; i<3; i++){
                so = new SomeObject();
                so.setId(1);
                so.setName("SomeName");
                al.add(so);
        }
 
        try{
                cpo.deleteObjects("IdNameDelete",al);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
deleteObjects in interface CpoAdapter
Parameters:
name - The String name of the DELETE Query group that will be used to create the object in the datasource. null signifies that the default rules will be used.
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects deleted from the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

executeObject

public <T> T executeObject(T object)
                throws CpoException
Executes an Object whose metadata will call an executable within the datasource. It is assumed that the executable object exists in the metadatasource. If the executable does not exist, an exception will be thrown.
Example:
 
 class SomeObject so = new SomeObject();
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                cpo.executeObject(so);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
executeObject in interface CpoAdapter
Parameters:
object - This is an Object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to populate the IN parameters used to executed the datasource object. An object of this type will be created and filled with the returned data from the value_object. This newly created object will be returned from this method.
Returns:
An object populated with the OUT parameters returned from the executable object
Throws:
CpoException - Thrown if there are errors accessing the datasource

executeObject

public <T> T executeObject(java.lang.String name,
                           T object)
                throws CpoException
Executes an Object whose metadata will call an executable within the datasource. It is assumed that the executable object exists in the metadatasource. If the executable does not exist, an exception will be thrown.
Example:
 
 class SomeObject so = new SomeObject();
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                cpo.executeObject("execNotifyProc",so);
        } catch (CpoException ce) {
        // Handle the error
        }
 }

Specified by:
executeObject in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which objects should be returned. The name also signifies what data in the object will be populated.
object - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to populate the IN parameters used to retrieve the collection of objects. This object defines the object type that will be returned in the collection and contain the result set data or the OUT Parameters.
Returns:
A result object populate with the OUT parameters
Throws:
CpoException - if there are errors accessing the datasource

executeObject

public <T,C> T executeObject(java.lang.String name,
                             C criteria,
                             T result)
                throws CpoException
Executes an Object that represents an executable object within the datasource. It is assumed that the object exists in the datasource. If the object does not exist, an exception will be thrown
Example:
 
 class SomeObject so = new SomeObject();
 class SomeResult sr = new SomeResult();
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                sr = (SomeResult)cpo.executeObject("execNotifyProc",so, sr);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
executeObject in interface CpoAdapter
Parameters:
name - The String name of the EXECUTE Query group that will be used to create the object in the datasource. null signifies that the default rules will be used.
criteria - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to populate the IN parameters used to retrieve the collection of objects.
result - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object defines the object type that will be created, filled with the return data and returned from this method.
Returns:
An object populated with the out parameters
Throws:
CpoException - Thrown if there are errors accessing the datasource

existsObject

public <T> long existsObject(T obj)
                  throws CpoException
The CpoAdapter will check to see if this object exists in the datasource.
Example:
 
 class SomeObject so = new SomeObject();
 long count = 0;
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                count = cpo.existsObject(so);
                if (count>0) {
                        // object exists
                } else {
                        // object does not exist
                }
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
existsObject in interface CpoAdapter
Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. This object will be searched for inside the datasource.
Returns:
The number of objects that exist in the datasource that match the specified object
Throws:
CpoException - Thrown if there are errors accessing the datasource

existsObject

public <T> long existsObject(java.lang.String name,
                             T obj)
                  throws CpoException
The CpoAdapter will check to see if this object exists in the datasource.
Example:
 
 class SomeObject so = new SomeObject();
 long count = 0;
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                count = cpo.existsObject("SomeExistCheck",so);
                if (count>0) {
                        // object exists
                } else {
                        // object does not exist
                }
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
existsObject in interface CpoAdapter
Parameters:
name - The String name of the EXISTS Query group that will be used to create the object in the datasource. null signifies that the default rules will be used.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. This object will be searched for inside the datasource.
Returns:
The number of objects that exist in the datasource that match the specified object
Throws:
CpoException - Thrown if there are errors accessing the datasource

existsObject

public <T> long existsObject(java.lang.String name,
                             T obj,
                             java.util.Collection<CpoWhere> wheres)
                  throws CpoException
The CpoAdapter will check to see if this object exists in the datasource.
Example:
 
 class SomeObject so = new SomeObject();
 long count = 0;
 class CpoAdapter cpo = null;
 
  
  try {
    cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
  } catch (CpoException ce) {
    // Handle the error
    cpo = null;
  }
  
  if (cpo!=null) {
    so.setId(1);
    so.setName("SomeName");
    try{
      CpoWhere where = cpo.newCpoWhere(CpoWhere.LOGIC_NONE, id, CpoWhere.COMP_EQ);
      count = cpo.existsObject("SomeExistCheck",so, where);
      if (count>0) {
        // object exists
      } else {
        // object does not exist
      }
    } catch (CpoException ce) {
      // Handle the error
    }
  }

Specified by:
existsObject in interface CpoAdapter
Parameters:
name - The String name of the EXISTS Query group that will be used to create the object in the datasource. null signifies that the default rules will be used.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. This object will be searched for inside the datasource.
where - A CpoWhere object that passes in run-time constraints to the query that performs the the exist
Returns:
The number of objects that exist in the datasource that match the specified object
Throws:
CpoException - Thrown if there are errors accessing the datasource

existsObject

protected <T> long existsObject(java.lang.String name,
                                T obj,
                                java.sql.Connection con,
                                java.sql.Connection metaCon,
                                java.util.Collection<CpoWhere> wheres)
                     throws CpoException
The CpoAdapter will check to see if this object exists in the datasource.

Parameters:
name - The name which identifies which EXISTS, INSERT, and UPDATE Query groups to execute to persist the object.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
con - The datasource Connection with which to check if the object exists
metaCon - metadataconnection
Returns:
The int value of the first column returned in the record set
Throws:
CpoException - exception will be thrown if the Query Group has a query count != 1

newOrderBy

public CpoOrderBy newOrderBy(java.lang.String attribute,
                             boolean ascending)
                      throws CpoException
newOrderBy allows you to dynamically change the order of the objects in the resulting collection. This allows you to apply user input in determining the order of the collection

Specified by:
newOrderBy in interface CpoAdapter
Parameters:
attribute - The name of the attribute from the pojo that will be sorted.
ascending - If true, sort ascending. If false sort descending.
Returns:
A CpoOrderBy object to be passed into retrieveBeans.
Throws:
CpoException - Thrown if there are errors accessing the datasource

newOrderBy

public CpoOrderBy newOrderBy(java.lang.String attribute,
                             boolean ascending,
                             java.lang.String function)
                      throws CpoException
newOrderBy allows you to dynamically change the order of the objects in the resulting collection. This allows you to apply user input in determining the order of the collection

Specified by:
newOrderBy in interface CpoAdapter
Parameters:
attribute - The name of the attribute from the pojo that will be sorted.
ascending - If true, sort ascending. If false sort descending.
function - A string which represents a datasource function that will be called on the attribute. must be contained in the function string. The attribute name will be replaced at run-time with its datasource counterpart
Returns:
A CpoOrderBy object to be passed into retrieveBeans.
Throws:
CpoException - Thrown if there are errors accessing the datasource

newWhere

public CpoWhere newWhere()
                  throws CpoException
DOCUMENT ME!

Specified by:
newWhere in interface CpoAdapter
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

newWhere

public <T> CpoWhere newWhere(int logical,
                             java.lang.String attr,
                             int comp,
                             T value)
                  throws CpoException
DOCUMENT ME!

Specified by:
newWhere in interface CpoAdapter
Parameters:
logical - DOCUMENT ME!
attr - DOCUMENT ME!
comp - DOCUMENT ME!
value - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

newWhere

public <T> CpoWhere newWhere(int logical,
                             java.lang.String attr,
                             int comp,
                             T value,
                             boolean not)
                  throws CpoException
DOCUMENT ME!

Specified by:
newWhere in interface CpoAdapter
Parameters:
logical - DOCUMENT ME!
attr - DOCUMENT ME!
comp - DOCUMENT ME!
value - DOCUMENT ME!
not - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

persistObject

public <T> long persistObject(T obj)
                   throws CpoException
Persists the Object into the datasource. The CpoAdapter will check to see if this object exists in the datasource. If it exists, the object is updated in the datasource If the object does not exist, then it is created in the datasource. This method stores the object in the datasource. This method uses the default EXISTS, CREATE, and UPDATE query groups specified for this object.
Example:
 
 class SomeObject so = new SomeObject();
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                cpo.persistObject(so);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
persistObject in interface CpoAdapter
Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
A count of the number of objects persisted
Throws:
CpoException - Thrown if there are errors accessing the datasource
See Also:
existsObject(T), insertObject(T), updateObject(T)

persistObject

public <T> long persistObject(java.lang.String name,
                              T obj)
                   throws CpoException
Persists the Object into the datasource. The CpoAdapter will check to see if this object exists in the datasource. If it exists, the object is updated in the datasource If the object does not exist, then it is created in the datasource. This method stores the object in the datasource.
Example:
 
 class SomeObject so = new SomeObject();
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                cpo.persistObject("persistSomeObject",so);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
persistObject in interface CpoAdapter
Parameters:
name - The name which identifies which EXISTS, INSERT, and UPDATE Query groups to execute to persist the object.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
A count of the number of objects persisted
Throws:
CpoException - Thrown if there are errors accessing the datasource
See Also:
existsObject(T), insertObject(T), updateObject(T)

persistObjects

public <T> long persistObjects(java.util.Collection<T> coll)
                    throws CpoException
Persists a collection of Objects into the datasource. The CpoAdapter will check to see if this object exists in the datasource. If it exists, the object is updated in the datasource If the object does not exist, then it is created in the datasource. This method stores the object in the datasource. The objects in the collection will be treated as one transaction, meaning that if one of the objects fail being inserted or updated in the datasource then the entire collection will be rolled back.
Example:
 
 class SomeObject so = null;
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        ArrayList al = new ArrayList();
        for (int i=0; i<3; i++){
                so = new SomeObject();
                so.setId(1);
                so.setName("SomeName");
                al.add(so);
        }
        try{
                cpo.persistObjects(al);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
persistObjects in interface CpoAdapter
Parameters:
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
DOCUMENT ME!
Throws:
CpoException - Thrown if there are errors accessing the datasource
See Also:
existsObject(T), insertObject(T), updateObject(T)

persistObjects

public <T> long persistObjects(java.lang.String name,
                               java.util.Collection<T> coll)
                    throws CpoException
Persists a collection of Objects into the datasource. The CpoAdapter will check to see if this object exists in the datasource. If it exists, the object is updated in the datasource If the object does not exist, then it is created in the datasource. This method stores the object in the datasource. The objects in the collection will be treated as one transaction, meaning that if one of the objects fail being inserted or updated in the datasource then the entire collection will be rolled back.
Example:
 
 class SomeObject so = null;
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        ArrayList al = new ArrayList();
        for (int i=0; i<3; i++){
                so = new SomeObject();
                so.setId(1);
                so.setName("SomeName");
                al.add(so);
        }
        try{
                cpo.persistObjects("myPersist",al);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
persistObjects in interface CpoAdapter
Parameters:
name - The name which identifies which EXISTS, INSERT, and UPDATE Query groups to execute to persist the object.
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
DOCUMENT ME!
Throws:
CpoException - Thrown if there are errors accessing the datasource
See Also:
existsObject(T), insertObject(T), updateObject(T)

retrieveBean

public <T> T retrieveBean(T bean)
               throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve query defined for this beans returns more than one row, an exception will be thrown.

Specified by:
retrieveBean in interface CpoAdapter
Parameters:
bean - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. The input bean is used to specify the search criteria, the output bean is populated with the results of the query.
Returns:
An bean of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBean

public <T> T retrieveBean(java.lang.String name,
                          T bean)
               throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve query defined for this beans returns more than one row, an exception will be thrown.

Specified by:
retrieveBean in interface CpoAdapter
Parameters:
name - DOCUMENT ME!
bean - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. The input bean is used to specify the search criteria, the output bean is populated with the results of the query.
Returns:
An bean of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBean

public <T,C> T retrieveBean(java.lang.String name,
                            C criteria,
                            T result,
                            java.util.Collection<CpoWhere> wheres,
                            java.util.Collection<CpoOrderBy> orderBy)
               throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve query defined for this beans returns more than one row, an exception will be thrown.

Specified by:
retrieveBean in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the parameters used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
Returns:
An bean of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBean

public <T,C> T retrieveBean(java.lang.String name,
                            C criteria,
                            T result,
                            java.util.Collection<CpoWhere> wheres,
                            java.util.Collection<CpoOrderBy> orderBy,
                            java.util.Collection<CpoNativeQuery> nativeQueries)
               throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource. If the retrieve query defined for this beans returns more than one row, an exception will be thrown.

Specified by:
retrieveBean in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the parameters used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
nativeQueries - Native query text that will be used to augment the query text stored in the meta data. This text will be embedded at run-time
Returns:
An bean of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <C> java.util.List<C> retrieveBeans(java.lang.String name,
                                           C criteria)
                                throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Specified by:
retrieveBeans in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the parameters used to retrieve the collection of beans.
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <C> java.util.List<C> retrieveBeans(java.lang.String name,
                                           C criteria,
                                           CpoWhere where,
                                           java.util.Collection<CpoOrderBy> orderBy)
                                throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Specified by:
retrieveBeans in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the parameters used to retrieve the collection of beans.
where - A CpoWhere bean that defines the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <C> java.util.List<C> retrieveBeans(java.lang.String name,
                                           C criteria,
                                           java.util.Collection<CpoWhere> wheres,
                                           java.util.Collection<CpoOrderBy> orderBy)
                                throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Specified by:
retrieveBeans in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the parameters used to retrieve the collection of beans.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <C> java.util.List<C> retrieveBeans(java.lang.String name,
                                           C criteria,
                                           java.util.Collection<CpoOrderBy> orderBy)
                                throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Specified by:
retrieveBeans in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the parameters used to retrieve the collection of beans.
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <T,C> java.util.List<T> retrieveBeans(java.lang.String name,
                                             C criteria,
                                             T result)
                                throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Specified by:
retrieveBeans in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the parameters used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <T,C> java.util.List<T> retrieveBeans(java.lang.String name,
                                             C criteria,
                                             T result,
                                             CpoWhere where,
                                             java.util.Collection<CpoOrderBy> orderBy)
                                throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Specified by:
retrieveBeans in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the parameters used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
where - A CpoWhere bean that defines the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <T,C> java.util.List<T> retrieveBeans(java.lang.String name,
                                             C criteria,
                                             T result,
                                             java.util.Collection<CpoWhere> wheres,
                                             java.util.Collection<CpoOrderBy> orderBy)
                                throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Specified by:
retrieveBeans in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the parameters used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <T,C> java.util.List<T> retrieveBeans(java.lang.String name,
                                             C criteria,
                                             T result,
                                             java.util.Collection<CpoWhere> wheres,
                                             java.util.Collection<CpoOrderBy> orderBy,
                                             java.util.Collection<CpoNativeQuery> nativeQueries)
                                throws CpoException
Retrieves the bean from the datasource. The assumption is that the bean exists in the datasource.

Specified by:
retrieveBeans in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the parameters used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
nativeQueries - Native query text that will be used to augment the query text stored in the meta data. This text will be embedded at run-time
Returns:
A collection of beans will be returned that meet the criteria specified by obj. The beans will be of the same type as the bean that was passed in. If no beans match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveBeans

public <T,C> CpoResultSet<T> retrieveBeans(java.lang.String name,
                                           C criteria,
                                           T result,
                                           java.util.Collection<CpoWhere> wheres,
                                           java.util.Collection<CpoOrderBy> orderBy,
                                           java.util.Collection<CpoNativeQuery> nativeQueries,
                                           int queueSize)
                              throws CpoException
Retrieves the bean from the datasource. This method returns an Iterator immediately. The iterator will get filled asynchronously by the cpo framework. The framework will stop supplying the iterator with beans if the beanBufferSize is reached. If the consumer of the iterator is processing records faster than the framework is filling it, then the iterator will wait until it has data to provide.

Specified by:
retrieveBeans in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which beans should be returned. The name also signifies what data in the bean will be populated.
criteria - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the parameters used to retrieve the collection of beans.
result - This is an bean that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the bean does not exist in the datasource, an exception will be thrown. This bean is used to specify the bean type that will be returned in the collection.
wheres - A collection of CpoWhere beans that define the constraints that should be used when retrieving beans
orderBy - The CpoOrderBy bean that defines the order in which beans should be returned
nativeQueries - Native query text that will be used to augment the query text stored in the meta data. This text will be embedded at run-time
beanBufferSize - the maximum number of beans that the Iterator is allowed to cache. Once reached, the CPO framework will halt processing records from the datasource.
Returns:
An iterator that will be fed beans from the CPO framework.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObject

@Deprecated
public <T> T retrieveObject(T obj)
                 throws CpoException
Deprecated. use retrieveBean

Retrieves the Object from the datasource. The assumption is that the object exists in the datasource. If the retrieve query defined for this objects returns more than one row, an exception will be thrown.

Specified by:
retrieveObject in interface CpoAdapter
Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. The input object is used to specify the search criteria, the output object is populated with the results of the query.
Returns:
An object of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObject

@Deprecated
public <T> T retrieveObject(java.lang.String name,
                                       T obj)
                 throws CpoException
Deprecated. use retrieveBean

Retrieves the Object from the datasource. The assumption is that the object exists in the datasource. If the retrieve query defined for this objects returns more than one row, an exception will be thrown.

Specified by:
retrieveObject in interface CpoAdapter
Parameters:
name - DOCUMENT ME!
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. The input object is used to specify the search criteria, the output object is populated with the results of the query.
Returns:
An object of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObject

@Deprecated
public <T,C> T retrieveObject(java.lang.String name,
                                         C criteria,
                                         T result,
                                         java.util.Collection<CpoWhere> wheres,
                                         java.util.Collection<CpoOrderBy> orderBy)
                 throws CpoException
Deprecated. use retrieveBean

Retrieves the Object from the datasource. The assumption is that the object exists in the datasource. If the retrieve query defined for this objects returns more than one row, an exception will be thrown.

Specified by:
retrieveObject in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which objects should be returned. The name also signifies what data in the object will be populated.
criteria - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to specify the parameters used to retrieve the collection of objects.
result - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to specify the object type that will be returned in the collection.
wheres - A collection of CpoWhere objects that define the constraints that should be used when retrieving objects
orderBy - The CpoOrderBy object that defines the order in which objects should be returned
Returns:
An object of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObject

@Deprecated
public <T,C> T retrieveObject(java.lang.String name,
                                         C criteria,
                                         T result,
                                         java.util.Collection<CpoWhere> wheres,
                                         java.util.Collection<CpoOrderBy> orderBy,
                                         java.util.Collection<CpoNativeQuery> nativeQueries)
                 throws CpoException
Deprecated. use retrieveBean

Retrieves the Object from the datasource. The assumption is that the object exists in the datasource. If the retrieve query defined for this objects returns more than one row, an exception will be thrown.

Specified by:
retrieveObject in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which objects should be returned. The name also signifies what data in the object will be populated.
criteria - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to specify the parameters used to retrieve the collection of objects.
result - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to specify the object type that will be returned in the collection.
wheres - A collection of CpoWhere objects that define the constraints that should be used when retrieving objects
orderBy - The CpoOrderBy object that defines the order in which objects should be returned
nativeQueries - Native query text that will be used to augment the query text stored in the meta data. This text will be embedded at run-time
Returns:
An object of the same type as the result parameter that is filled in as specified the metadata for the retireve.
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObjects

@Deprecated
public <T,C> java.util.Collection<T> retrieveObjects(java.lang.String name,
                                                                C criteria,
                                                                java.util.Collection<CpoWhere> wheres,
                                                                java.util.Collection<CpoOrderBy> orderBy,
                                                                T result)
                                        throws CpoException
Deprecated. use retrieveBeans

Retrieves the Object from the datasource. The assumption is that the object exists in the datasource.

Specified by:
retrieveObjects in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which objects should be returned. The name also signifies what data in the object will be populated.
criteria - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to specify the parameters used to retrieve the collection of objects.
result - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to specify the object type that will be returned in the collection.
wheres - A collection of CpoWhere objects that define the constraints that should be used when retrieving objects
orderBy - The CpoOrderBy object that defines the order in which objects should be returned
Returns:
A collection of objects will be returned that meet the criteria specified by obj. The objects will be of the same type as the Object that was passed in. If no objects match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObjects

@Deprecated
public <T,C> java.util.Collection<T> retrieveObjects(java.lang.String name,
                                                                C criteria,
                                                                java.util.Collection<CpoWhere> wheres,
                                                                java.util.Collection<CpoOrderBy> orderBy,
                                                                java.util.Collection<CpoNativeQuery> nativeQueries,
                                                                T result)
                                        throws CpoException
Deprecated. use retrieveBeans

Retrieves the Object from the datasource. The assumption is that the object exists in the datasource.

Specified by:
retrieveObjects in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which objects should be returned. The name also signifies what data in the object will be populated.
criteria - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to specify the parameters used to retrieve the collection of objects.
result - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to specify the object type that will be returned in the collection.
wheres - A collection of CpoWhere objects that define the constraints that should be used when retrieving objects
orderBy - The CpoOrderBy object that defines the order in which objects should be returned
nativeQueries - Native query text that will be used to augment the query text stored in the meta data. This text will be embedded at run-time
Returns:
A collection of objects will be returned that meet the criteria specified by obj. The objects will be of the same type as the Object that was passed in. If no objects match the criteria, an empty collection will be returned
Throws:
CpoException - Thrown if there are errors accessing the datasource

retrieveObjects

@Deprecated
public <T,C> CpoResultSet<T> retrieveObjects(java.lang.String name,
                                                        C criteria,
                                                        java.util.Collection<CpoWhere> wheres,
                                                        java.util.Collection<CpoOrderBy> orderBy,
                                                        java.util.Collection<CpoNativeQuery> nativeQueries,
                                                        T result,
                                                        int queueSize)
                                throws CpoException
Deprecated. use retrieveBeans

Retrieves the Object from the datasource. This method returns an Iterator immediately. The iterator will get filled asynchronously by the cpo framework. The framework will stop supplying the iterator with objects if the objectBufferSize is reached. If the consumer of the iterator is processing records faster than the framework is filling it, then the iterator will wait until it has data to provide.

Specified by:
retrieveObjects in interface CpoAdapter
Parameters:
name - The filter name which tells the datasource which objects should be returned. The name also signifies what data in the object will be populated.
criteria - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to specify the parameters used to retrieve the collection of objects.
result - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to specify the object type that will be returned in the collection.
wheres - A collection of CpoWhere objects that define the constraints that should be used when retrieving objects
orderBy - The CpoOrderBy object that defines the order in which objects should be returned
nativeQueries - Native query text that will be used to augment the query text stored in the meta data. This text will be embedded at run-time
objectBufferSize - the maximum number of objects that the Iterator is allowed to cache. Once reached, the CPO framework will halt processing records from the datasource.
Returns:
An iterator that will be fed objects from the CPO framework.
Throws:
CpoException - Thrown if there are errors accessing the datasource

transactObjects

@Deprecated
public <T> long transactObjects(java.util.Collection<CpoObject<T>> coll)
                     throws CpoException
Deprecated. 

Allows you to perform a series of object interactions with the database. This method pre-dates CpoTrxAdapter and can be used without a programmer needing to remember to call commit() or rollback().
Example:
 
 class SomeObject so = null;
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        ArrayList al = new ArrayList();
        so = new SomeObject();
        so.setId(1);
        so.setName("SomeName");
        CpoObject cobj = new CpoObject(CpoAdapter.CREATE,"MyCreate",so);
        al.add(cobj);
        so = new SomeObject();
        so.setId(3);
        so.setName("New Name");
        CpoObject cobj = new CpoObject(CpoAdapter.PERSIST,"MyPersist",so);
        al.add(cobj);
        try{
                cpo.transactObjects(al);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
transactObjects in interface CpoAdapter
Parameters:
coll - This is a collection of CpoObject objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects updated in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

transactObjects

@Deprecated
protected <T> long transactObjects(java.util.Collection<CpoObject<T>> coll,
                                              java.sql.Connection c,
                                              java.sql.Connection meta)
                        throws CpoException
Deprecated. 

DOCUMENT ME!

Parameters:
coll - DOCUMENT ME!
meta - metadata conn
c - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

updateObject

public <T> long updateObject(T obj)
                  throws CpoException
Update the Object in the datasource. The CpoAdapter will check to see if the object exists in the datasource. If it exists then the object will be updated. If it does not exist, an exception will be thrown
Example:
 
 class SomeObject so = new SomeObject();
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                cpo.updateObject(so);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
updateObject in interface CpoAdapter
Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects updated in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

updateObject

public <T> long updateObject(java.lang.String name,
                             T obj)
                  throws CpoException
Update the Object in the datasource. The CpoAdapter will check to see if the object exists in the datasource. If it exists then the object will be updated. If it does not exist, an exception will be thrown
Example:
 
 class SomeObject so = new SomeObject();
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        so.setId(1);
        so.setName("SomeName");
        try{
                cpo.updateObject("updateSomeObject",so);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
updateObject in interface CpoAdapter
Parameters:
name - The String name of the UPDATE Query group that will be used to create the object in the datasource. null signifies that the default rules will be used.
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects updated in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

updateObjects

public <T> long updateObjects(java.util.Collection<T> coll)
                   throws CpoException
Updates a collection of Objects in the datasource. The assumption is that the objects contained in the collection exist in the datasource. This method stores the object in the datasource. The objects in the collection will be treated as one transaction, meaning that if one of the objects fail being updated in the datasource then the entire collection will be rolled back, if supported by the datasource.
Example:
 
 class SomeObject so = null;
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        ArrayList al = new ArrayList();
        for (int i=0; i<3; i++){
                so = new SomeObject();
                so.setId(1);
                so.setName("SomeName");
                al.add(so);
        }
        try{
                cpo.updateObjects(al);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
updateObjects in interface CpoAdapter
Parameters:
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects updated in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

updateObjects

public <T> long updateObjects(java.lang.String name,
                              java.util.Collection<T> coll)
                   throws CpoException
Updates a collection of Objects in the datasource. The assumption is that the objects contained in the collection exist in the datasource. This method stores the object in the datasource. The objects in the collection will be treated as one transaction, meaning that if one of the objects fail being updated in the datasource then the entire collection will be rolled back, if supported by the datasource.
Example:
 
 class SomeObject so = null;
 class CpoAdapter cpo = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        ArrayList al = new ArrayList();
        for (int i=0; i<3; i++){
                so = new SomeObject();
                so.setId(1);
                so.setName("SomeName");
                al.add(so);
        }
        try{
                cpo.updateObjects("myUpdate",al);
        } catch (CpoException ce) {
                // Handle the error
        }
 }

Specified by:
updateObjects in interface CpoAdapter
Parameters:
name - The String name of the UPDATE Query group that will be used to create the object in the datasource. null signifies that the default rules will be used.
coll - This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown.
Returns:
The number of objects updated in the datasource
Throws:
CpoException - Thrown if there are errors accessing the datasource

setContext

protected void setContext(javax.naming.Context context)
                   throws CpoException
DOCUMENT ME!

Parameters:
context - DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

getContext

protected javax.naming.Context getContext()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getDataSourceMap

protected java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,JdbcMetaClass<?>>> getDataSourceMap()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setDataSourceMap

protected void setDataSourceMap(java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.String,JdbcMetaClass<?>>> dsMap)

getGroupType

protected <T> java.lang.String getGroupType(T obj,
                                            java.lang.String type,
                                            java.lang.String name,
                                            java.sql.Connection c,
                                            java.sql.Connection meta)
                                 throws CpoException
DOCUMENT ME!

Parameters:
obj - DOCUMENT ME!
type - DOCUMENT ME!
name - DOCUMENT ME!
c - DOCUMENT ME!
meta - metadata conn
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

getMetaClass

protected <T> JdbcMetaClass<T> getMetaClass(T obj,
                                            java.sql.Connection c)
                                 throws CpoException
DOCUMENT ME!

Parameters:
obj - DOCUMENT ME!
c - connection
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

getMetaClassMap

protected java.util.HashMap<java.lang.String,JdbcMetaClass<?>> getMetaClassMap()

getReadConnection

protected java.sql.Connection getReadConnection()
                                         throws CpoException
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

setReadDataSource

protected void setReadDataSource(javax.sql.DataSource readDataSource)
DOCUMENT ME!

Parameters:
readDataSource - DOCUMENT ME!

getReadDataSource

protected javax.sql.DataSource getReadDataSource()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getWriteConnection

protected java.sql.Connection getWriteConnection()
                                          throws CpoException
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

getStaticConnection

protected java.sql.Connection getStaticConnection()
                                           throws CpoException
Throws:
CpoException

isStaticConnection

protected boolean isStaticConnection(java.sql.Connection c)

setStaticConnection

protected void setStaticConnection(java.sql.Connection c)

setWriteDataSource

protected void setWriteDataSource(javax.sql.DataSource writeDataSource)
DOCUMENT ME!

Parameters:
writeDataSource - DOCUMENT ME!

getWriteDataSource

protected javax.sql.DataSource getWriteDataSource()
DOCUMENT ME!

Returns:
DOCUMENT ME!

getMetaConnection

protected java.sql.Connection getMetaConnection()
                                         throws CpoException
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

setMetaDataSource

protected void setMetaDataSource(javax.sql.DataSource metaDataSource)
DOCUMENT ME!

Parameters:
metaDataSource - DOCUMENT ME!

getMetaDataSource

protected javax.sql.DataSource getMetaDataSource()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setMetaDataSourceName

protected void setMetaDataSourceName(java.lang.String metaDataSourceName)
DOCUMENT ME!

Parameters:
metaDataSourceName - DOCUMENT ME!

getMetaDataSourceName

protected java.lang.String getMetaDataSourceName()
DOCUMENT ME!

Returns:
DOCUMENT ME!

closeConnection

protected void closeConnection(java.sql.Connection connection)
DOCUMENT ME!

Parameters:
connection - DOCUMENT ME!

commitConnection

protected void commitConnection(java.sql.Connection connection)
DOCUMENT ME!

Parameters:
connection - DOCUMENT ME!

rollbackConnection

protected void rollbackConnection(java.sql.Connection connection)
DOCUMENT ME!

Parameters:
connection - DOCUMENT ME!

processExecuteGroup

protected <T,C> T processExecuteGroup(java.lang.String name,
                                      C criteria,
                                      T result)
                         throws CpoException
Executes an Object whose MetaData contains a stored procedure. An assumption is that the object exists in the datasource.

Parameters:
name - The filter name which tells the datasource which objects should be returned. The name also signifies what data in the object will be populated.
criteria - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to populate the IN parameters used to retrieve the collection of objects.
result - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object defines the object type that will be returned in the
Returns:
A result object populate with the OUT parameters
Throws:
CpoException - DOCUMENT ME!

processExecuteGroup

protected <T,C> T processExecuteGroup(java.lang.String name,
                                      C criteria,
                                      T result,
                                      java.sql.Connection conn,
                                      java.sql.Connection metaCon)
                         throws CpoException
DOCUMENT ME!

Parameters:
name - DOCUMENT ME!
criteria - DOCUMENT ME!
result - DOCUMENT ME!
conn - DOCUMENT ME!
metaCon - metadata connection
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processSelectGroup

protected <T> T processSelectGroup(T obj,
                                   java.lang.String groupName)
                        throws CpoException
Retrieves the Object from the datasource.

Parameters:
obj - This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. The input object is used to specify the search criteria.
groupName - The name which identifies which RETRIEVE Query group to execute to retrieve the object.
Returns:
A populated object of the same type as the Object passed in as a parameter. If no objects match the criteria a NULL will be returned.
Throws:
CpoException - the retrieve query defined for this objects returns more than one row, an exception will be thrown.

processSelectGroup

protected <T> T processSelectGroup(T obj,
                                   java.lang.String groupName,
                                   java.sql.Connection con,
                                   java.sql.Connection metaCon)
                        throws CpoException
DOCUMENT ME!

Parameters:
obj - DOCUMENT ME!
groupName - DOCUMENT ME!
con - DOCUMENT ME!
metaCon - metadata connection
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processSelectGroup

protected <T,C> java.util.List<T> processSelectGroup(java.lang.String name,
                                                     C criteria,
                                                     T result,
                                                     java.util.Collection<CpoWhere> wheres,
                                                     java.util.Collection<CpoOrderBy> orderBy,
                                                     java.util.Collection<CpoNativeQuery> nativeQueries,
                                                     boolean useRetrieve)
                                        throws CpoException
DOCUMENT ME!

Parameters:
name - DOCUMENT ME!
criteria - DOCUMENT ME!
result - DOCUMENT ME!
where - DOCUMENT ME!
orderBy - DOCUMENT ME!
useRetrieve - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processSelectGroup

protected <T,C> void processSelectGroup(java.lang.String name,
                                        C criteria,
                                        T result,
                                        java.util.Collection<CpoWhere> wheres,
                                        java.util.Collection<CpoOrderBy> orderBy,
                                        java.util.Collection<CpoNativeQuery> nativeQueries,
                                        boolean useRetrieve,
                                        CpoResultSet<T> resultSet)
                           throws CpoException
Throws:
CpoException

processSelectGroup

protected <T,C> void processSelectGroup(java.lang.String name,
                                        C criteria,
                                        T result,
                                        java.util.Collection<CpoWhere> wheres,
                                        java.util.Collection<CpoOrderBy> orderBy,
                                        java.util.Collection<CpoNativeQuery> nativeQueries,
                                        java.sql.Connection con,
                                        java.sql.Connection metaCon,
                                        boolean useRetrieve,
                                        CpoResultSet<T> resultSet)
                           throws CpoException
DOCUMENT ME!

Parameters:
name - DOCUMENT ME!
criteria - DOCUMENT ME!
result - DOCUMENT ME!
where - DOCUMENT ME!
orderBy - DOCUMENT ME!
con - DOCUMENT ME!
metaCon - DOCUMENT ME!
useRetrieve - DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processUpdateGroup

protected <T> long processUpdateGroup(T obj,
                                      java.lang.String groupType,
                                      java.lang.String groupName)
                           throws CpoException
DOCUMENT ME!

Parameters:
obj - DOCUMENT ME!
groupType - DOCUMENT ME!
groupName - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processUpdateGroup

protected <T> long processUpdateGroup(T obj,
                                      java.lang.String groupType,
                                      java.lang.String groupName,
                                      java.sql.Connection con,
                                      java.sql.Connection metaCon)
                           throws CpoException
DOCUMENT ME!

Parameters:
obj - DOCUMENT ME!
groupType - DOCUMENT ME!
groupName - DOCUMENT ME!
con - DOCUMENT ME!
metaCon - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processBatchUpdateGroup

protected <T> long processBatchUpdateGroup(T[] arr,
                                           java.lang.String groupType,
                                           java.lang.String groupName,
                                           java.sql.Connection con,
                                           java.sql.Connection metaCon)
                                throws CpoException
DOCUMENT ME!

Parameters:
arr - DOCUMENT ME!
groupType - DOCUMENT ME!
groupName - DOCUMENT ME!
con - DOCUMENT ME!
metaCon - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processUpdateGroup

protected <T> long processUpdateGroup(java.util.Collection<T> coll,
                                      java.lang.String groupType,
                                      java.lang.String groupName)
                           throws CpoException
DOCUMENT ME!

Parameters:
coll - DOCUMENT ME!
groupType - DOCUMENT ME!
groupName - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

processUpdateGroup

protected <T> long processUpdateGroup(java.util.Collection<T> coll,
                                      java.lang.String groupType,
                                      java.lang.String groupName,
                                      java.sql.Connection con,
                                      java.sql.Connection meta)
                           throws CpoException
DOCUMENT ME!

Parameters:
coll - DOCUMENT ME!
groupType - DOCUMENT ME!
groupName - DOCUMENT ME!
con - DOCUMENT ME!
meta - DOCUMENT ME!
Returns:
DOCUMENT ME!
Throws:
CpoException - DOCUMENT ME!

getCpoTrxAdapter

public CpoTrxAdapter getCpoTrxAdapter()
                               throws CpoException
Provides a mechanism for the user to obtain a CpoTrxAdapter object. This object allows the to control when commits and rollbacks occur on CPO.
Example:
 
 class SomeObject so = null;
 class CpoAdapter cpo = null;
 class CpoTrxAdapter cpoTrx = null;
 
 try {
        cpo = new JdbcCpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false));
        cpoTrx = cpo.getCpoTrxAdapter();
 } catch (CpoException ce) {
        // Handle the error
        cpo = null;
 }
 
 if (cpo!=null) {
        try{
                for (int i=0; i<3; i++){
                        so = new SomeObject();
                        so.setId(1);
                        so.setName("SomeName");
                        cpo.updateObject("myUpdate",so);
                }
                cpoTrx.commit();
        } catch (CpoException ce) {
                // Handle the error
                cpoTrx.rollback();
        }
 }

Specified by:
getCpoTrxAdapter in interface CpoAdapter
Returns:
A CpoTrxAdapter to manage the transactionality of CPO
Throws:
CpoException - Thrown if there are errors accessing the datasource
See Also:
CpoTrxAdapter

getDbTablePrefix

public java.lang.String getDbTablePrefix()

setDbTablePrefix

public void setDbTablePrefix(java.lang.String dbTablePrefix)

isConnectionBusy

protected boolean isConnectionBusy(java.sql.Connection c)

setConnectionBusy

protected void setConnectionBusy(java.sql.Connection c)

clearConnectionBusy

protected void clearConnectionBusy(java.sql.Connection c)


Copyright © 2010. All Rights Reserved.