[jboss-dev-forums] [Design of EJB 3.0] - Rollback Tx on EJBException (NoSuchEJBException)?

ALRubinger do-not-reply at jboss.com
Thu Aug 14 01:58:15 EDT 2008


EJB 3.0 Spec Reference is 14.4.2, 14.4.2.3:

I've got some failing tests on SFSB remove - the client expects a NoSuchEJBException, and the current Ejb3TxPolicy is wrapping it in a EJBTransactionRolledbackException before marking the Tx itself for rollback.

I can make some of these tests pass with the patch below, though I can't derive from the spec whether or not EJBExceptions should warrant the Tx to be marked for rollback.

Index: transactions/src/main/java/org/jboss/ejb3/tx/Ejb3TxPolicy.java
  | ===================================================================
  | --- transactions/src/main/java/org/jboss/ejb3/tx/Ejb3TxPolicy.java	(revision 77044)
  | +++ transactions/src/main/java/org/jboss/ejb3/tx/Ejb3TxPolicy.java	(working copy)
  | @@ -103,6 +103,11 @@
  |           {
  |              t = new EJBTransactionRolledbackException(formatException("Unexpected Error", t));
  |           }
  | +         // If this is an EJBException, pass through to the caller
  | +         else if(t instanceof EJBException)
  | +         {
  | +            throw t;
  | +         }
  |           else if(t instanceof RuntimeException || t instanceof RemoteException)
  |           {
  |              t = new EJBTransactionRolledbackException(t.getMessage(), (Exception) t);

>From what I can discern, the onus to continue/recover is a decision left to the client?

S,
ALR



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4170479#4170479

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4170479



More information about the jboss-dev-forums mailing list