Exception Handling in EJB Transactions. 2004-02-24 - By Vadlamudi, Ranga Rao (Cognizant)
Back context.setRollbackOnly() is the best way
-- --Original Message-- -- From: Basava Rajesh [mailto:Basava.Rajesh@(protected)] Sent: Tuesday, February 24, 2004 11:28 AM To: J2EEPATTERNS-INTEREST@(protected) Subject: Exception Handling in EJB Transactions.
Hi, The EJB 2.0 specification states that if an EJBException is thrown, the container shall rollback the transaction while for Application level Exceptions, the container does not. But since EJBException is a RuntimeException(and thus is not checked), should the Application Exceptions thrown in the Data/Business layer extend EJBException?? Or do we catch the Application Exceptions and do a manual context.setRollbackOnly().
What would be the best way to handle rollback of Transactions when Application Exceptions are thrown? TIA, Rajesh.
==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
|
|