Chapter 8 Creating J2EE Applications for BEA WebLogic


Transaction Management Responsibilities

Session EJBs can rely on their own code, their client's code, or the WebLogic Server container to define transaction boundaries. Entity beans can use container- or client-demarcated transaction boundaries, but they cannot define their own transaction boundaries unless they observe certain restrictions.

If bean- or client-managed transactions are required, the managing code must use the javax.transaction.UserTransaction interface. The EJB or client can then access a UserTransaction object via JNDI and specify transaction boundaries with explicit calls to tx.begin(), tx.commit(), tx.rollback(), and so forth.

For EJBs that use container-managed transactions (or EJBs that mix container and bean-managed transactions) the EJB 1.1 specification defines several deployment elements to control the transactional requirements for individual EJB methods.

Note that if the EJB provider does not specify a transaction attribute for a method in the ejb-jar.xml file, WebLogic Server uses the supports attribute by default.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.