Using Container-Managed Transactions

The recommended way to manage transactions in an EJB application is to let the container manage them for you. This is known as container-managed transaction demarcation and it allows you to direct the control of transactions using a declarative syntax. Instead of making calls to a UserTransaction object programmatically, you can determine how the boundaries of transactions should be defined through entries in the deployment descriptor for an EJB. This approach instructs the container to make calls to the transaction manager (through the TransactionManager interface) to start and stop transactions on your behalf.

The first thing to understand about container-managed transaction demarcation is why it’s useful. ...

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.