bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

Programming WebLogic J2EE Connectors

Transaction Management

The following sections describe the various types of transaction levels supported by the WebLogic J2EE Connector Architecture and explain how to specify the transaction levels in the resource adapter RAR archive.

- Supported Transaction Levels

- Specifying the Transaction Levels in the RAR Configuration

- Transaction Management Contract

Supported Transaction Levels

Transactional access to EISes is an important requirement for business applications. The J2EE Connector Architecture supports the concept of transactions—a number of operations that must be committed together or not at all for the data to remain consistent and to maintain data integrity.

The BEA WebLogic Server J2EE Connector Architecture implementation utilizes WebLogic Server's robust Transaction Manager implementation and supports resource adapters having the following transaction support levels (as described in the J2EE Connector Specification, Version 1.0 Final Release):

- XA Transaction support—allows a transaction to be managed by a transaction manager external to a resource adapter (and therefore external to an EIS). A resource adapter defines the type of transaction support by specifying the transaction-support element in the ra.xml file; a resource adapter can only support one type. When an application component demarcates an EIS connection request as part of a transaction, the application server is responsible for enlisting the XA resource with the transaction manager. When the application component closes that connection, the application server de-lists the XA resource from the transaction manager and cleans up the EIS connection once the transaction has completed.

- Local Transaction support—allows an application server to manage resources, which are local to the resource adapter. Unlike XA transaction, it cannot participate in a two-phase commit protocol (2PC). A resource adapter defines the type of transaction support by specifying the transaction-support element in the resource adapter ra.xml file; a resource adapter can only support one type. When an application component requests for an EIS connection, the application server starts a local transaction based on the current transaction context. When the application component closes that connection, the application server does a commit on the local transaction and also cleans up the EIS connection once the transaction has completed.

  Note: Refer to the following Sun Microsystems documentation for information on the ra.xml document type definition: http://java.sun.com/dtd/connector_1_0.dtd

- No Transaction support—in general, if a resource adapter does not support XA or Local Transaction support (and therefore "supports" No Transaction), it means that if an application component needs to use that resource adapter, the application component must not involve any connections to the EIS, represented by that resource adapter, in a transaction. However, if an application component needs to involve EIS connections in a transaction, the application component must interact with a resource adapter that supports XA or Local Transactions.

For more information on supported transaction levels, see the "Transaction Management" chapter in the J2EE Connector Specification, Version 1.0 Final Release (http://java.sun.com/j2ee/download.html#connectorspec).

Specifying the Transaction Levels in the RAR Configuration

The resource adapter specifies which kind of transaction it supports in the ra.xml deployment descriptor file provided by Sun Microsystems. For instructions on specifying the transaction level type in the RAR, refer to Configuring the Transaction Level Type in Configuration.

Note: Refer to the following Sun Microsystems documentation for information on the ra.xml document type definition: http://java.sun.com/dtd/connector_1_0.dtd

Transaction Management Contract

In many cases, a transaction (termed local transaction) is limited in scope to a single EIS system, and the EIS resource manager itself manages such a transaction. While an XA transaction (or global transaction) can span multiple resource managers. This form of transaction requires transaction coordination by an external transaction manager, typically bundled with an application server. A transaction manager uses a two-phase commit protocol (2PC) to manage a transaction that spans multiple resource managers (EISes). It uses one-phase commit optimization if only one resource manager is participating in an XA transaction.

The J2EE Connector Architecture defines a transaction management contract between an application server and a resource adapter (and its underlying resource manager). The transaction management contract extends the connection management contract and provides support for management of both local and XA transactions. The transaction management contract has two parts, depending on the type of transaction.

- JTA XAResource based contract between a transaction manager and an EIS resource manager

- Local transaction management contract

These contracts enable an application server such as WebLogic Server to provide the infrastructure and runtime environment for transaction management. Application components rely on this transaction infrastructure to support the component-level transaction model.

Because EIS implementations are so varied, the transactional support must be very flexible. The J2EE Connector Architecture imposes no requirements on the EIS for transaction management. Depending on the implementation of transactions within the EIS, a resource adapter may provide:

- No transaction support at all—this is typical of legacy applications and many back-end systems.

- Support for only local transactions

- Support for both local and XA transactions

WebLogic Server supports all three levels of transactions, ensuring its support of EISes at different transaction levels.