Helping ordinary people create extraordinary websites!
GET OUR NEWSLETTER
Your Email:
 

Understanding JCA Transactions

By Mikhail Genkin
2005-04-22


Transaction Support Levels

Different EISs have different transactional behavior. Some EISs do not support transactions at all. Some support transactions but do not support the two-phase commit (2PC) protocol. These are said to support local transactions. Some EISs support local transactions and 2PC. These are said to support distributed, or global transactions. Global transactions are also often called XA transactions because they involve the XAResource interface.

Listing 1 shows a snippet from ra.xml for the CICSECI resource adapter that you'll use to access EIS1. The LocalTransaction value for the <transaction-support> element indicates that this resource adapter supports local transactions but cannot participate in global transactions. The OrderService session bean uses this resource adapter to access CRM transactions that contain EIS1.

Listing 1. Snippet of the ra.xml descriptor for CICSECI resource adapter

<!DOCTYPE connector PUBLIC "-//Sun Microsystems, Inc.//DTD Connector 1.0//EN"

"http://java.sun.com/dtd/connector_1_0.dtd">

<connector>
<display-name>ECIResourceAdapter</display-name>
<description>CICS J2EE ECI Resource Adapter</description>
<vendor-name>IBM</vendor-name>
<spec-version>1.0</spec-version>
<eis-type>CICS</eis-type>
<version>5.0.0 </version>
<license>
<description> </description>
<license-required>true</license-required>
</license>
<resourceadapter>
<managedconnectionfactory-class>
com.ibm.connector2.cics.ECIManagedConnectionFactory</managedconnectionfactory-class>
<connectionfactory-interface>
javax.resource.cci.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>
com.ibm.connector2.cics.ECIConnectionFactory</connectionfactory-impl-class>
<connection-interface>javax.resource.cci.Connection</connection-interface>
<connection-impl-class>com.ibm.connector2.cics.ECIConnection</connection-impl-class>
<transaction-support>LocalTransaction</transaction-support>
Listing 2 shows a snippet from ra.xml for the IMS resource adapter that I use to access EIS 2. In this case the XATransaction value for the <transaction-support> element indicates that the resource adapter supports global, or distributed transactions.

Listing 2. Snippet of the ra.xml descriptor for IMS resource adapter

<!DOCTYPE connector PUBLIC "-//Sun Microsystems, Inc.//DTD Connector 1.0//EN"

"http://java.sun.com/dtd/connector_1_0.dtd">

<connector>
<display-name>IMS Connector for Java</display-name>
<description>J2EE Connector Architecture resource adapter for IMS
accessing IMS transactions using IMS Connect </description>
<vendor-name>IBM Corporation</vendor-name>
<spec-version>1.0</spec-version>
<eis-type>IMS</eis-type>
<version>1.2.6</version>
<license>
<description>IMS Connector for Java is a component of the IMS Connect product and as such
is not separately licensed. It requires an IMS Connect license.</description>
<license-required>true</license-required>
</license>
<resourceadapter>
<managedconnectionfactory-class>
com.ibm.connector2.ims.ico.IMSManagedConnectionFactory</managedconnectionfactory-class>
<connectionfactory-interface>
javax.resource.cci.ConnectionFactory</connectionfactory-interface>
<connectionfactory-impl-class>
com.ibm.connector2.ims.ico.IMSConnectionFactory</connectionfactory-impl-class>
<connection-interface>
javax.resource.cci.Connection</connection-interface>
<connection-impl-class>
com.ibm.connector2.ims.ico.IMSConnection</connection-impl-class>
<transaction-support>XATransaction</transaction-support>
<config-property>


Tutorial Pages:
» Learn How the Various Levels of Transaction Support Provided by Different EISs and Resource Adapters Can Affect Application Design.
» Overview of JCA Transactions
» Transaction Support Levels
» JCA Transaction Support
» Transaction Demarcation Strategies
» Programmatic Transaction Demarcation
» EJB Deployment Descriptor Settings
» In Conclusion
» Resources


First published by IBM DeveloperWorks


 | Bookmark
Related Tutorials:
» All about JAXP, Part 1
» Make Database Queries Without the Database
» Load List Values for Improved Efficiency
» 2 Ways To Implement Session Tracking
» A Simple Way to Read an XML File in Java
» Develop Aspect-Oriented Java Applications with Eclipse and AJDT

Advertise with Us!


Tutorials Scripts Web Hosting Developer Manuals
Resources