Best Practice for Choosing Transaction Attributes

In this section, we discuss the best practices for choosing the appropriate transaction attributes. The recommended choice for a transaction attribute is Required because it ensures that the methods of an enterprise bean are invoked under a JTA transaction. These EJBs can be made to perform work under the scope of a single transaction.

  • If an enterprise bean method needs to commit its results unconditionally, the RequiresNew transaction attribute is the right choice. That attribute always creates a new transaction, regardless of whether another transaction is in progress—an example is logging. The appropriate method in the EJB that performs logging should be invoked with the RequiresNew attribute. ...

Get BEA WebLogic Server™ 8.1 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.