This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes EJB and other Java EE Technologies and the fly likes Transaction rollback in ejb2.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Transaction rollback in ejb2.0" Watch "Transaction rollback in ejb2.0" New topic
Author

Transaction rollback in ejb2.0

Sagar Kale
Ranch Hand

Joined: May 02, 2008
Posts: 188
Hi All,

The ejb2.0 specification says if SystemException is thrown in business method, transaction will be rolled back.

What if ApplicationException is thrown?

The transaction is not rolled back?
[ August 31, 2008: Message edited by: Sagar Kale ]
Bupjae Lee
Ranch Hand

Joined: May 14, 2007
Posts: 107
If business method throws application exception, then the container does not rollback "automatically".

If you think transaction should be rollback, you still can rollback it manually by EJBContext.setRollbackOnly() [CMT bean] or UserTransaction.rollback() [BMT bean]
Sagar Kale
Ranch Hand

Joined: May 02, 2008
Posts: 188
Thank you
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Transaction rollback in ejb2.0