4 Replies Latest reply on Aug 12, 2004 8:16 AM by Alexey Loubyansky

    Transaction RequiresNew Problem

    Apex Apex Newbie

      Hi,

      I'm using JBoss 3.2.1 with Hibernate 2.1 and a DB2 local-tx-datasource (driver file: db2jcc.jar). There is one methodA with transaction attribute "Required" calling another methodB with attribute "RequiresNew". Normally I would assume when methodA is rolled back, changes made in methodB are not affected. But this is not the case. All changes made in methodA and methodB get rolled back.

      Why does this happen? Does anybody know about this issue?

      best regards


      To illustrate things, a method call hierarchy in pseudo code:

      [Required]
      methodA() {
      
       // Read/write business data.
      
       [RequiresNew]
       methodB() {
       // Write log messages.
       // Should not be affected by a rollback in methodA.
       // But it is.
       }
      
       // Rollback methodA.
       getSessionContext().setRollbackOnly();
      }