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); }
I solved this problem. After I catch SQLException, I have to throw new EJBException to make JBOSS to handle my roll back.
Sorry for the noise