3 Replies Latest reply on Nov 13, 2006 7:30 AM by Kevin Conner

    Should java.lang.Errors roll back transactions?

    Jonas Bergström Newbie

      Hello, I'm using transactions within the embeddable EJB3 container (RC9).

      In some parts of my business logic I am using asserts to verify some state.
      When an assert fails, an AssertionError is thrown, which is caught by the EJB's and converted in to a TransactionRolledBackException.

      Is that really the correct behavior?
      I thought transacted EJB's should catch runtime/remote exceptions (except for those annotated with ApplicationException(rollback=false)). And I also thought that the general idea with java.lang.Error is that the application shouldn't try to recover from one of those since they may lead to undeterministic behavior.

      So, what I'm saying is, shouldn't the transacted EJB's catch Exceptions rather than Throwables?


      Thnx / Jonas