my dog learned polymorphism*
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
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Transaction rollback in ejb2.0
 
Similar Threads
Doubt on EJBExceptiion and EJB Transaction Rolledback Exception
Exceptions
BMT stateful SB and incomplete trans: behaviour question
Can the client continue after getting the exception ??? and other doubts
JMS