4 Replies Latest reply on May 12, 2015 8:01 AM by tomjenkinson

    Strange Transaction Behaviour of REQUIRES_NEW

    puneetsrivastava


      Hi,

       

      I am using EAP 5.2.0, EJB 3.0, and Oracle 11g. I am facing strange issue and seek your help. We have 2 EJBs EJB 1 with transaction attribute "Required", which calls EJB 2,  EJB 2 method has trnsaction attribute as "Requires_New". The issue I am facing is EJB 2 method inserts 4 record in new transaction but when we view the data in same transaction it shows only 3 records ( first inserted record is not visible). After analysis I found that Somehow the first record is getting associated with parent transaction i.e. EJB 1 method. I concluded this because as soon as the EJB 1 method exits all 4 record are visible in DB (in code as well as in Sql Developer) and when the parent transaction rolls back the first record never get stored in DB. This is strange behaviour, the record inserted in one transaction should be visible in the same transaction.

       

      We are using Oracle XA data source.

        • 1. Re: Starange Transaction Behaviour of REQUIRES_NEW
          wdfink

          Did you have a simple reproducer for this?

          As you are using an older EAP versions I would recommend to open a support case here https://access.redhat.com/home

          • 2. Re: Strange Transaction Behaviour of REQUIRES_NEW
            tomjenkinson

            +1 I would say we need a reproducer for that behaviour. I am not even sure how it would be possible. What are you doing in EJB1? I assume some other transactional work?

            • 3. Re: Strange Transaction Behaviour of REQUIRES_NEW
              renga.samy7

              What Puneet is saying is that  the connection that is started/used in the parent transaction, if it is used in a REQUIRES_NEW child transaction, then the changes done by child transaction on top that connection is only visible when the parent transaction commits.

               

              I think this behaviour might be due to the Parent transaction not delisting the resource when it calls the REQUIRES_NEW child transaction and so the changes done by both parent and child on top of same connection is visible only when the parent transaction is committed.

               

              Work Around that i tried is using a new connection for very transaction in this case REQUIRES_NEW behaviour is correct.

               

              So i think its a problem with the transaction and its resource associations. Something is going wrong here. enlist/delist or JCA issue or do JBOSS demands new connection for very transaction?

              • 4. Re: Strange Transaction Behaviour of REQUIRES_NEW
                tomjenkinson

                Hi,

                 

                I think you will need to try to reproduce this on WFLY. There are many many enhancements since EAP 5.2 and it would be difficult to be sure its not something that has been subsequently modified. Alternatively if you have a support contract I would recommend raising a ticket with the support team to get it looked into.

                 

                Sorry I can't be more help,

                Tom