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

Rolling back a transaction

Transaction errors will frequently result in the transaction being roll backed. That is, any and all operations performed would be reversed and the database will be restored to its previous state. Rollback will automatically occur when a Java unchecked exception is thrown. A rollback may also be performed explicitly by the EJB when conditions warrant a rollback. In a BMT either the UserTransaction's rollback or setRollbackOnly methods are used to explicitly rollback the transaction. In a CMT, the setRollbackOnly method is used. The setRollbackOnly method is designed to be used with a two-phase commit protocol. The invocation of the method is a way to vote for a rollback.

Getting ready

The general approach to rolling back ...

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