wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes In page 556 of HFEJB what's the answer for Point no.6? 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 » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "In page 556 of HFEJB what Watch "In page 556 of HFEJB what New topic
Author

In page 556 of HFEJB what's the answer for Point no.6?

saran ram
Ranch Hand

Joined: Dec 13, 2002
Posts: 69
In page 556, point 6,
A bean wants the client to get an application exception, but the bean still wants the transaction to commit. What should the bean do? what's the answer for this?
Bart Laeremans
Greenhorn

Joined: Aug 06, 2001
Posts: 6
I'm just studying for the exam myself, and I think the
answer is as followed.

The bean should just throw the application exception,
because only system exception would automatically cause
the transaction to rollback.

To roleback a transaction with a application exception
the bean should call setRollbackOnly before throwing
the exception.

Greetings
saran ram
Ranch Hand

Joined: Dec 13, 2002
Posts: 69
Bart, that means,if we call setRollbackOnly() before throwing
the exception, will the transaction surly gets committed?
Thiru Thangavelu
Ranch Hand

Joined: Aug 29, 2001
Posts: 219
No, If you call setRollbackOnly() before throwing the exception, the transaction will never get committed. If you don't call the container will commit the transaction before throwing the application exception.


Thanks,<br />Thiru<br />[SCJP,SCWCD,SCBCD]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: In page 556 of HFEJB what's the answer for Point no.6?