Bean-Managed Transaction Demarcation

If an EJB is deployed using bean-managed transaction demarcation (here referred to as BMTD), the EJB container allows the bean to obtain a reference to a javax.transaction.UserTransaction object using the EJBContext shown in Figure 8.3. Entity beans cannot use BMTD, therefore the following discussion only applies to Session beans and Message-Driven beans. (If you are interested you should read the EJB specification for the design decisions justifying why Entity beans cannot use BMTD.)

Motivation and Restrictions

An EJB might need to be deployed under BMTD if the conditions on which a transaction is started depend on some programmatic condition. It could be that one Session bean method starts the transaction ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition 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.