Using Client-Demarcated Transactions

You’ve seen client transactions referenced throughout this chapter without much mention of how they’re started and completed. When you’re using container-managed demarcation, the container transparently starts a transaction if a bean method needs one and the client hasn’t provided it. If you choose bean-managed demarcation, you can start a transaction using the getUserTransaction method of EJBContext and the begin method of the UserTransaction. These cases handle the situations where a call to a bean method coincides with the start of a transaction or where a transaction context is received from another EJB. What hasn’t been covered is the situation where the client providing the transaction context isn’t ...

Get Special Edition Using Enterprise JavaBeans™ 2.0 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.