EclipseLink transactional data sources are externally managed if the connection pool is managed by a transaction service (such as an application server controlled transaction or a JTA transaction). A JTA managed data source or connection pool is commonly used in Jakarta EE applications and normally required in EJB applications. Use an externally-managed connection pool as follows:
Configure the session to use an ExternalTransactionController
to integrate EclipseLink's persistence unit with the external transaction service. Use the eclipselink.target-server persistence
unit property to configure the name of the class that implements the ExternalTransactionController
interface.
Use the boolean external-transaction-controller
option on the persistence unit to indicate that the transaction is managed by a transaction manager and should not be managed by EclipseLink. This can also be used if the datasource does not support transactions to specify the connection's login and inform EclipseLink that the connection is maintained by the external controller.
You may need to configure the EclipseLink read connection pool or sequence connection pool to use a non-JTA connection pool in order to avoid transactional overhead. For more information, see "Default (Write) and Read Connection Pools" and "Sequence Connection Pools".