1 Reply Latest reply on Feb 3, 2004 8:20 AM by efesler

    null transaction after RollbackException

    efesler

      Hi,

      I'm using Jboss 2.4.10 together with MvcSoft.

      I have a service bean with a method incrementing a counter in the DB. Since this method is used quite often, I marked it with transaction level "Required New" to reduce the scope and the time of the transaction.

      Unfortunately, I still have some Optimistic rollback exception. To solve this, I wanted to implement a retry process if the transaction failed. In the calling service bean (the one calling the service with theRequired New transaction level), I tried to catch the exception and retry the method call. But it didn't work because the original transaction (the one of the calling service) seem to be lost.

      I looked a little further and discover that when I do transactionManager.getTransaction() in the calling service, this return me null when the increment transaction is rollbacked.

      When no problem occur in the increment transaction, transactionManager.getTransaction() returns the calling transaction as expected.

      Does anybody have an idea how I can implement this retry process?

      Thanks,

      --ERic

        • 1. Re: null transaction after RollbackException
          efesler

          I found what the issue was.

          In the TxInterceptorCMT, for method with RequiresNew transaction level, if an exception occurs during the commit of the new transaction, the transaction manager is not reset to point back to the calling transaction.

          I made the change and it seems to work.

          --ERic