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

    Strange Transaction Behaviour of REQUIRES_NEW

    Puneet Srivastava Newbie



      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.