Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 16. Transactions > Transaction Best Practices

16.6. Transaction Best Practices

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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial