Global transactions

 

+

Search Tips   |   Advanced Search

 

If an application uses two or more resources, an external transaction manager is needed to coordinate the updates to both resource managers in a global transaction.

Global transaction support is available to Web and enterprise bean J2EE components and, with some limitation, to application client components. Enterprise bean components can be subdivided into beans that exploit container-managed transactions (CMT) or bean-managed transactions (BMT).

BMT enterprise beans, application client components, and Web components can use the Java Transaction API (JTA) UserTransaction interface to define the demarcation of a global transaction. To obtain the UserTransaction interface, use a JNDI lookup of java:comp/UserTransaction, or use the getUserTransaction method from the SessionContext object.

The UserTransaction interface is not available to CMT enterprise beans. If CMT enterprise beans attempt to obtain this interface, an exception is thrown, in accordance with the EJB specification.

Ensure that programs that perform a JNDI lookup of the UserTransaction interface use an InitialContext that resolves to a local implementation of the interface. Also, ensure that such programs use a JNDI location that is appropriate for the EJB version.

The JNDI location of the UserTransaction interface is specified in the EJB V1.1 specification. Before this specification, the JNDI location of the UserTransaction interface was defined by each implementer of an EJB container. For WAS, the location is as follows:

A Web component or enterprise bean (CMT or BMT) can get the ExtendedJTATransaction interface through a lookup of java:comp/websphere/ExtendedJTATransaction. This interface provides access to the transaction identity and a mechanism to receive notification of transaction completion.


 

Related concepts

Extended JTA support
Local transaction containment (LTC)
Client support for transactions
Transaction support in WAS