3.9.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 DataSources 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 Integrating with the Transaction Manager above.

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