1 Reply Latest reply on Mar 3, 2006 1:13 PM by kaymenji

    Transaction roll back in JBOSS

    kaymenji

      I have a session bean A who accessing two entity beans, (B and C). The session bean A try to insert new records into 2 tables by jndi look up those
      2 entity beans, B and C.

      Insert new records into B is successfully, but when insert new records into C I got exception came out, but JBOSS is not rolling back the records saved by entity bean B.

      I am writing my program in this way:

      
      //session bean method
      
      public void insertNewRecords() throws Exception{
      
       //JNDI Look up to get B home interface and C home interface
       //insert records to B
       BHomeinterface.create(XXXXX);
      
       //insert records to C
       CHomeinterface.create(XXXXXXX, XXXXX);
      }
      
      


      Exception came out after I called "CHomeinterface.create(XXXXXXX, XXXXX);". According to JBOSS document, if I put " <transaction-type>Container</transaction-type>" in ejb-jar.xml, JBoss is supposed to handle transaction for me , right?

      But why JBoss is not rolling back new records in B? It came out with still insert new records into B, and C no record insertion.

      Am I doing someting wrong on transaction programming? Or I have to handle the transaction in program? Then what does JBOss do on helping handling transaction? It seems it does not work even I let JBOSS to handle transaction for me.