aspose file tools*
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 Java 8 in Action this week in the Java 8 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

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
I agree. Here's the link:
subject: Transaction rollback in ejb2.0
Similar Threads
BMT stateful SB and incomplete trans: behaviour question
Can the client continue after getting the exception ??? and other doubts
Doubt on EJBExceptiion and EJB Transaction Rolledback Exception