Package org.synchronoss.cpo.jdbc
Class JdbcCpoAdapterFactory
java.lang.Object
org.synchronoss.cpo.jdbc.JdbcCpoAdapterFactory
- All Implemented Interfaces:
CpoAdapterFactory
JDBC implementation of
CpoAdapterFactory, vending JdbcCpoAdapter,
transaction-scoped JdbcCpoTrxAdapter, and JdbcCpoXaAdapter instances backed by a
single underlying JdbcCpoAdapter.- Author:
- dberry
-
Constructor Summary
ConstructorsConstructorDescriptionJdbcCpoAdapterFactory(JdbcCpoAdapter jdbcCpoAdapter) Constructs a JdbcCpoAdapterFactory from a JdbcCpoAdapter -
Method Summary
Modifier and TypeMethodDescriptionProvides a mechanism for the user to obtain a CpoTrxAdapter object.
-
Constructor Details
-
JdbcCpoAdapterFactory
Constructs a JdbcCpoAdapterFactory from a JdbcCpoAdapter- Parameters:
jdbcCpoAdapter- A JdbcCpoAdapter
-
-
Method Details
-
getCpoAdapter
- Specified by:
getCpoAdapterin interfaceCpoAdapterFactory- Throws:
CpoException
-
getCpoTrxAdapter
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:
getCpoTrxAdapterin interfaceCpoAdapterFactory- Returns:
- A CpoTrxAdapter to manage the transactionality of CPO
- Throws:
CpoException- Thrown if there are errors accessing the datasource- See Also:
-
getCpoXaAdapter
- Specified by:
getCpoXaAdapterin interfaceCpoAdapterFactory- Throws:
CpoException
-