Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We recommend the following transaction management best practices :
Use declarative transaction management rather than programmatic transactions whenever possible.
When using declarative transactions with EJBs, consider using Required as the first choice for a transaction attribute.
When using distributed transactions, use XA-enabled resources and XA-enabled drivers whenever possible. Be aware of the limitations of emulating XA for a non-XA resource.
Avoid mixing direct transaction management using JTA with implicit transaction management done through a resource-specific API such as JDBC or JMS since this complicates the transaction management picture.
Consider leveraging the session façade design pattern for creating coarse-grained transactions.
Minimize the use of client-managed transactions wherever possible. The session façade can be useful here.
Carefully evaluate the need and implementation of an optimistic concurrency strategy.