I have a Stateless Session Bean named ManagerEJB with a method name insert(..), in which, I create 3 entities AEJB, BEJB and CEJB. But when I fail to create a BEJB (with an exception I catched), in my database, still have a new row of table A.
In my ejb-jar.xml file, I have had the following declaration:
All of my entities bean and session bean are CMT.
Please help me!
Enhance ManagerEJB with the following field and method:
private javax.ejb.SessionContext sessionCtxt = null;
public void setSessionContext( javax.ejb.SessionContext ctxt )
this.sessionCtxt = ctxt;
in catch-block of the exception:
This will cause a rollback instead of a commit when leaving the SessionBean method.