O'Reilly logo

EJB 3.1 Cookbook by Richard M. Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling transactions manually

Handling a transaction manually provides the developer with more control over the transaction, but requires more work. This type of transaction control is called a BMT.

It is possible to begin and start a transaction anywhere within a method. The boundaries of a transaction are explicitly set using the begin and commit transaction methods. For CMT the boundaries of a transaction are effectively the method. BMTs are only possible for session- and message-driven beans. They cannot be used for entities.

Getting ready

The steps used to handle transactions manually include:

  1. Using the @TransactionManagement annotation to specify bean-managed transactions
  2. Injecting an instance of the UserTransaction object
  3. Enclosing the transaction ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required