Class JdbcCpoXaAdapter
- All Implemented Interfaces:
Serializable,AutoCloseable,XAResource,CpoAdapter,CpoTrxAdapter,CpoXaResource
It manages a local and global CpoTrxAdapter and manages the association of XIDs to transactions
The XAResource interface is a Java mapping of the industry standard XA interface based on the X/Open CAE Specification (Distributed Transaction Processing: The XA Specification).
The XA interface defines the contract between a Resource Manager and a Transaction Manager in a distributed transaction processing (DTP) environment. A JDBC driver or a JMS provider implements this interface to support the association between a global transaction and a database or message service connection.
The XAResource interface can be supported by any transactional resource that is intended to be used by application programs in an environment where transactions are controlled by an external transaction manager. An example of such a resource is a database management system. An application may access data through multiple database connections. Each database connection is enlisted with the transaction manager as a transactional resource. The transaction manager obtains an XAResource for each connection participating in a global transaction. The transaction manager uses the start method to associate the global transaction with the resource, and it uses the end method to disassociate the transaction from the resource. The resource manager is responsible for associating the global transaction to all work performed on its data between the start and end method invocations.
At transaction commit time, the resource managers are informed by the transaction manager to prepare, commit, or rollback a transaction according to the two-phase commit protocol.
- See Also:
-
Field Summary
Fields inherited from interface javax.transaction.xa.XAResource
TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY -
Constructor Summary
ConstructorsConstructorDescriptionJdbcCpoXaAdapter(JdbcCpoAdapterFactory jdbcCpoAdapterFactory) Construct a JdbcCpoXaAdapter -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the current transaction behind the CpoTrxAdapter.voidcloseResource(JdbcCpoAdapter jdbcCpoAdapter) voidcommit()Commits the current transaction behind the CpoTrxAdaptervoidcommitResource(JdbcCpoAdapter jdbcCpoAdapter) <T> longdeleteBean(CpoQuery query, T bean) <T> longdeleteBeans(CpoQuery query, List<T> beans) <T,C> T executeBean(CpoQuery query, C criteria, T result) <T> longexistsBean(CpoQuery query, T bean) intgetCpoAttributes(String expression) int<T> longinsertBean(CpoQuery query, T bean) <T> longinsertBeans(CpoQuery query, List<T> beans) booleanisClosed()Returns true if the TrxAdapter has been closed, false if it is still activebooleanisSameRM(XAResource xaResource) newOrderBy(String attribute, boolean ascending) newOrderBy(String attribute, boolean ascending, String function) newOrderBy(String marker, String attribute, boolean ascending) newOrderBy(String marker, String attribute, boolean ascending, String function) newWhere()<T> CpoWherenewWhere(Logical logical, String attr, Comparison comp, T value) <T> CpoWherenewWhere(Logical logical, String attr, Comparison comp, T value, boolean not) <T,C> T retrieveBean(CpoQuery query, C criteria, T result) <T> TretrieveBean(CpoQuery query, T bean) <T,C> Stream <T> retrieveBeans(CpoQuery query, C criteria, T result) voidrollback()Rollback the current transaction behind the CpoTrxAdaptervoidrollbackResource(JdbcCpoAdapter jdbcCpoAdapter) voidsetBatchSize(int batchSize) voidsetFetchSize(int fetchSize) <T> longupdateBean(CpoQuery query, T bean) <T> longupdateBeans(CpoQuery query, List<T> beans) <T> longupsertBean(CpoQuery query, T bean) <T> longupsertBeans(CpoQuery query, List<T> beans) Methods inherited from class org.synchronoss.cpo.core.jta.CpoBaseXaResource
accept, apply, close, closeAssociated, commit, end, forget, getTransactionTimeout, prepare, recover, rollback, setTransactionTimeout, startMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.synchronoss.cpo.core.CpoAdapter
deleteBean, deleteBean, deleteBeans, deleteBeans, executeBean, executeBean, existsBean, existsBean, insertBean, insertBean, insertBeans, insertBeans, retrieveBean, retrieveBean, retrieveBeans, retrieveBeans, retrieveBeans, updateBean, updateBean, updateBeans, updateBeans, upsertBean, upsertBean, upsertBeans, upsertBeans
-
Constructor Details
-
JdbcCpoXaAdapter
Construct a JdbcCpoXaAdapter- Parameters:
jdbcCpoAdapterFactory- - The adapter factory to use to create the JdbcCpoXaAdapter- Throws:
CpoException- - An error getting the JdbcCpoXaAdapter
-
-
Method Details
-
commit
Commits the current transaction behind the CpoTrxAdapter- Specified by:
commitin interfaceCpoTrxAdapter- Throws:
CpoException
-
rollback
Rollback the current transaction behind the CpoTrxAdapter- Specified by:
rollbackin interfaceCpoTrxAdapter- Throws:
CpoException
-
close
Closes the current transaction behind the CpoTrxAdapter. All subsequent calls to the CpoTrxAdapter will throw an exception.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCpoTrxAdapter- Throws:
CpoException
-
isClosed
Returns true if the TrxAdapter has been closed, false if it is still active- Specified by:
isClosedin interfaceCpoTrxAdapter- Throws:
CpoException
-
insertBean
- Specified by:
insertBeanin interfaceCpoAdapter- Throws:
CpoException
-
insertBeans
- Specified by:
insertBeansin interfaceCpoAdapter- Throws:
CpoException
-
deleteBean
- Specified by:
deleteBeanin interfaceCpoAdapter- Throws:
CpoException
-
deleteBeans
- Specified by:
deleteBeansin interfaceCpoAdapter- Throws:
CpoException
-
updateBean
- Specified by:
updateBeanin interfaceCpoAdapter- Throws:
CpoException
-
updateBeans
- Specified by:
updateBeansin interfaceCpoAdapter- Throws:
CpoException
-
upsertBean
- Specified by:
upsertBeanin interfaceCpoAdapter- Throws:
CpoException
-
upsertBeans
- Specified by:
upsertBeansin interfaceCpoAdapter- Throws:
CpoException
-
existsBean
- Specified by:
existsBeanin interfaceCpoAdapter- Throws:
CpoException
-
executeBean
- Specified by:
executeBeanin interfaceCpoAdapter- Throws:
CpoException
-
retrieveBean
- Specified by:
retrieveBeanin interfaceCpoAdapter- Throws:
CpoException
-
retrieveBean
- Specified by:
retrieveBeanin interfaceCpoAdapter- Throws:
CpoException
-
retrieveBeans
- Specified by:
retrieveBeansin interfaceCpoAdapter- Throws:
CpoException
-
newOrderBy
- Specified by:
newOrderByin interfaceCpoAdapter- Throws:
CpoException
-
newOrderBy
public CpoOrderBy newOrderBy(String marker, String attribute, boolean ascending) throws CpoException - Specified by:
newOrderByin interfaceCpoAdapter- Throws:
CpoException
-
newOrderBy
public CpoOrderBy newOrderBy(String attribute, boolean ascending, String function) throws CpoException - Specified by:
newOrderByin interfaceCpoAdapter- Throws:
CpoException
-
newOrderBy
public CpoOrderBy newOrderBy(String marker, String attribute, boolean ascending, String function) throws CpoException - Specified by:
newOrderByin interfaceCpoAdapter- Throws:
CpoException
-
newWhere
- Specified by:
newWherein interfaceCpoAdapter- Throws:
CpoException
-
newWhere
public <T> CpoWhere newWhere(Logical logical, String attr, Comparison comp, T value) throws CpoException - Specified by:
newWherein interfaceCpoAdapter- Throws:
CpoException
-
newWhere
public <T> CpoWhere newWhere(Logical logical, String attr, Comparison comp, T value, boolean not) throws CpoException - Specified by:
newWherein interfaceCpoAdapter- Throws:
CpoException
-
getCpoMetaDescriptor
- Specified by:
getCpoMetaDescriptorin interfaceCpoAdapter
-
getDataSourceName
- Specified by:
getDataSourceNamein interfaceCpoAdapter
-
getFetchSize
public int getFetchSize()- Specified by:
getFetchSizein interfaceCpoAdapter
-
setFetchSize
public void setFetchSize(int fetchSize) - Specified by:
setFetchSizein interfaceCpoAdapter
-
getBatchSize
public int getBatchSize()- Specified by:
getBatchSizein interfaceCpoAdapter
-
setBatchSize
public void setBatchSize(int batchSize) - Specified by:
setBatchSizein interfaceCpoAdapter
-
getCpoAttributes
- Specified by:
getCpoAttributesin interfaceCpoAdapter- Throws:
CpoException
-
isSameRM
- Specified by:
isSameRMin interfaceXAResource- Throws:
XAException
-
commitResource
- Throws:
XAException
-
rollbackResource
- Throws:
XAException
-
createNewResource
- Throws:
XAException
-
closeResource
- Throws:
XAException
-