This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread 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 Java Interview Guide this week in the Jobs Discussion 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
It's not a secret anymore!