2 Replies Latest reply on Jan 8, 2004 11:18 AM by aalmero

    rollback problem with some RequiresNew

    mmqwertz

       

      "mmqwertz" wrote:
      Hi!
      I have a problem or more a question concerning RequiresNew. As far as I read in the J2EE and EJB Spec and in this forum and the JBoss Doku there are no nested transactions in JBoss right?

      Now I implemented a CMP Entity Bean and set the transaction attributes for all methods to "RequiresNew".

      The sequence of method calls is like this:

      Client (without transaction) calls
      |
      |
      Method1 (with transaction attribute RequiresNew) calls
      |
      |
      Method2 (with transaction attribute RequiresNew)
      |
      Method2 returns without error.
      |
      |
      Method3 (with transaction attribute RequiresNew)
      |
      Method3 returns without error.
      |
      |
      ERROR in Method1 causes Rollback

      This rollback in Method1 causes to rollback all changes in Method1, Method2, Method3!


      How is this possible?
      If there are only flat transactions, I would assume all changes from Method2 and Method3 are already commited when the methods return, So a rollback in Method1 shouldn't rollback changes from Method2 and Method3! In my opition Method2 and 3 must be declared as "Required" to show the behaviour stated above or there must be nested transactions.


      Can anyone explain to me what's going on there?
      Thanks!


        • 1. Re: rollback problem with some RequiresNew
          mmqwertz

           

          "mmqwertz" wrote:
          Sorry, my fault!

          I called a local method using
          this.increaseBalance() inside a CMP Entity Bean, so there was no possibility for the container to create a new Transaction for Method "increaseBalance()" in this case!


          • 2. Re: rollback problem with some RequiresNew
            aalmero

             

            "aalmero" wrote:
            Hi !
            I tried to use CMT on my EJB but did not get rollback when i have forced one method to error.

            Client (without transaction) calls
            |
            |
            Method1 (with transaction attribute RequiresNew)
            |
            |
            Method2 (with transaction attribute Required)
            |
            Method2 returns with error.
            |
            |
            Method3 (with transaction attribute Required
            |
            Method3 returns without error.

            error in Method2 should cause a rollback of Method1, but it did not happend at all.

            Please advise as how it is done. Is there anythinh i need to do with my code?


            Thanks