This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes CMT and Business method exceptions - question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "CMT and Business method exceptions - question" Watch "CMT and Business method exceptions - question" New topic
Author

CMT and Business method exceptions - question

Saeed Amer
Ranch Hand

Joined: Jan 20, 2004
Posts: 140
Hi everyone,

How will the EJB container handle exceptions thrown by a business method of a bean with container managed transaction demarcation?

For example, if the instance did not call setRollbackOnly(), would the container COMMIT the transaction or ROLLBACK the transaction and Why?

My opinion is that the transaction should be rolledback but I may be wrong.

I understand that if the instance called setRollbackOnly(), the container will rollback the transaction.

TIA,

Saeed
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10433
    
176

If any Runtime exception occurs, then the container will rollback the transaction. See section 8.7.4. Unchecked Exceptions at:

[ UD: removed link to copyrighted material ]
[ August 03, 2007: Message edited by: Ulf Dittmer ]

[My Blog] [JavaRanch Journal]
Saeed Amer
Ranch Hand

Joined: Jan 20, 2004
Posts: 140
Thank you so much Jaikiran!

The link you have provided is very useful.
Do you have link to the latest version of these books? These books are like 6 to 8 years old.

Thanks again!

Saeed
[ February 21, 2006: Message edited by: Saeed Amer ]
 
 
subject: CMT and Business method exceptions - question
 
It's not a secret anymore!