Skip Headers
Oracle® Fusion Middleware Programming Resource Adapters for Oracle WebLogic Server
12c Release 1 (12.1.1)

Part Number E24971-03
Go to Documentation Home
Go to Table of Contents
Go to Feedback page
Contact Us

Go to previous page
Go to next page
PDF · Mobi · ePub

7 Transaction Management

This chapter describes the system-level transaction management contract that is used for outbound communication from WebLogic Server to Enterprise Information Systems.

This chapter includes the following sections:

For more information about transaction management, see Chapter 7, "Transaction Management," in JSR 322: Java EE Connector Architecture 1.6. For information about transaction management for inbound communication from EISes to WebLogic Server, see Transactional Inflow.

Supported Transaction Levels

A transaction is a set of operations that must be committed together or not at all for the data to remain consistent and to maintain data integrity. Transactional access to EISes is an important requirement for business applications. The Java EE Connector Architecture 1.6 supports the use of transactions.

WebLogic Server utilizes the WebLogic Server Transaction Manager implementation and supports resource adapters having XA, local, or no transaction support. You define the type of transaction support in the transaction-support element in the ra.xml file; a resource adapter can support only one type. You can use the transaction-support element in the weblogic-ra.xml deployment descriptor to override the value specified in ra.xml. See Configuring Transaction Levels, and transaction-support in Table A-18, "default-connection-properties subelements" for details.

Resource adapters conforming to Java EE Connector Architecture 1.6 can optionally specify the level of transaction support at run time. This requires the implementation of the TransactionSupport interface. For more information, see Specifying and Obtaining Transaction Support Level.

XA Transaction Support

XA transaction support allows a transaction to be managed by a transaction manager external to a resource adapter (and therefore external to an EIS). 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 cleans up the EIS connection once the transaction has completed.

Oracle recommends creating a LocalTransaction outbound connection pool for an XA transaction capable resource adapter for improved performance.

Local Transaction Support

Local transaction support allows WebLogic Server to manage resources that are local to the resource adapter. Unlike XA transaction, local transaction generally cannot participate in a two-phase commit protocol (2PC). The only way a local transaction resource adapter can be involved in a 2PC transaction is if it is the only local transaction resource involved in the transaction and if the WebLogic Server Connector container uses a Last Resource Commit Optimization whereby the outcome of the transaction is governed by the resource adapter's local transaction.

A local transaction is normally started by using the API that is specific to that resource adapter, or the CCI interface if it is supported for that adapter. When a resource adapter connection that is configured to use local transaction support is created and used within the context of an XA transaction, WebLogic Server automatically starts a local transaction to be used for this connection. When the XA transaction completes and is ready to commit, prepare is first called on the XA resources that are part of the XA transaction. Next, the local transaction is committed.

If the commit fails on the local transaction, the XA transaction and all the XA resources are rolled back. If the commit succeeds, all the XA resources for the XA transaction are committed. When an application component closes the connection, WebLogic Server cleans up the connection once the transaction has completed.

No Transaction Support

If a resource adapter is configured to use no transaction support, the resource adapter can still be used in the context of a transaction. However, in this case, the connections used for that resource adapter are never enlisted in a transaction and behave as if no transaction was present. In other words, operations performed using these connections are made to the underlying EIS immediately, and if the transaction is rolled back, the changes are not undone for these connections.

Runtime Transaction Support Level Specification

JSR 322: Java EE Connector Architecture 1.6 states that a resource adapter may optionally determine and classify the level of transaction support it can provide at run time. To expose information about the level of transaction support at run time, a ManagedConnectionFactory must implement the TransactionSupport interface. JSR 322: Java EE Connector Architecture 1.6 also defines rules and priorities on transaction support levels set in descriptors, annotations, and the TransactionSupport interface. For example, WebLogic Server uses the value returned by the getTransactionSupport method and ignores the value specified by the resource adapter's deployment descriptor and the @Connector metadata annotation.

WebLogic Server exposes information about the runtime transaction support level in the ConnectorConnectionPoolRuntimeMBean.RuntimeTransactionSupport MBean attribute and also in the Administration Console.

To view the runtime transaction level support in the Administration Console:

  1. In the Summary of Deployments page, select the resource adapter.

  2. Click Monitoring > Outbound Connection Pools, and view the items in the Runtime Transaction Support column.

Configuring Transaction Levels

You specify a transaction support level for a resource adapter in the Java EE standard resource adapter deployment descriptor, ra.xml. To specify the transaction support level:

Resource adapters conforming to Java EE Connector Architecture 1.6 can optionally specify the level of transaction support at run time. This requires the implementation of the TransactionSupport interface. For more information, see Specifying and Obtaining Transaction Support Level.

The transaction support value specified in the ra.xml deployment descriptor is the default value for all Connection Factories of the resource adapter. You can override this value for a particular Connection Factory by specifying a value in the transaction-support element of the weblogic-ra.xml deployment descriptor.

The value of transaction-support must be one of the following:

For more information on specifying the transaction level in the ra.xml deployment descriptor, see Section 20.7, "Resource Adapter XML Schema Definition," in JSR 322: Java EE Connector Architecture 1.6. For more information on specifying the transaction level in the weblogic-ra.xml deployment descriptor, see Appendix A, "weblogic-ra.xml Schema."

Configure XA Transaction Recovery Credential Mapping

For pools which support XA Transactions, WebLogic Server may try to perform transaction recovery for the Java EE Connector Architecture connection pool if WebLogic Server finds pending transactions in the pool during a server startup. If pending transactions are found, WebLogic Server gets a ManagedConnection to EIS during recovery using ManagedConnectionFactory.createManagedConnection( subject, ConnectionRequestInfo cxRequestInfo).

If EIS requires explicit credentials (such as user name and password) to sign-on, the you need to configure WebLogic Server with appropriate credentials by configuring a special credential mapping for the initial connection. See Initial Connection: Requires a ManagedConnection from Adapter Without Application's Request. WebLogic Server uses null as Subject if a mapping is not found.


You don't need to configure this special credential mapping if the EIS doesn't require explicit credentials.