3. XA Transactions
Prev | Chapter 8. Deployment | Next

## 3. XA Transactions

The X/Open Distributed Transaction Processing (X/Open DTP) model, designed by The Open Group (a vendor consortium), defines a standard communication architecture that provides the following:

- Concurrent execution of applications on shared resources.

- Coordination of transactions across applications.

- Components, interfaces, and protocols that define the architecture and provide portability of applications.

- Atomicity of transaction systems.

- Single-thread control and sequential function-calling.

The X/Open DTP XA standard defines the application programming interfaces that a resource manager uses to communicate with a transaction manager. The XA interfaces enable resource managers to join transactions, to perform two-phase commit, and to recover in-doubt transactions following a failure.

### 3.1. Using OpenJPA with XA Transactions

OpenJPA supports XA-compliant transactions when used in a properly configured managed environment. The following components are required:

- A managed environment that provides an XA compliant transaction manager. Examples of this are application servers such as WebLogic or JBoss.

- Instances of a `javax.sql.XADataSource` for each of the `DataSource`s that OpenJPA will use.

Given these components, setting up OpenJPA to participate in distributed transactions is a simple two-step process:

1. Integrate OpenJPA with your application server's transaction manager, as detailed in Section 2, “ Integrating with the Transaction Manager ” above.

2. Point OpenJPA at an enlisted `XADataSource`, and configure a second non-enlisted data source. See Section 2.1, “ Managed and XA DataSources ”.

Prev | Up | Next
2. Integrating with the Transaction Manager | Home | Chapter 9. Runtime Extensions