setRollbackOnly()
SUBSCRIBE EJB-INTEREST anonymous <[email protected]> Sun, 6 Nov 2005 16:34:22 -0700
| Newsgroups | gmane.comp.java.sun.ejb.general |
|---|---|
| Message-ID | <LISTSERV%[email protected]> |
Hi,
I have a question.
I have a stateless session bean.
I want to rollback the transaction when an application exception occured.
There are two options to do.Please let me know which one would be better.
Option 1:
try{
//perform database operation}
catch(DataAccessException ex){
getSessionContext().setRollbackOnly()
}
Option 2:
try{
//perform database operation}
catch(DataAccessException ex){
throw new EJBException(ex);
}
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[email protected] and include in the body of the message "help".