Close
jGuru Forums
Posted By: Khyati_Rana Posted On: Friday, February 18, 2005 04:20 AM
Hi I have a sessionBean with CMT. The following is the method with Required Attribute in Bean: method A() { try { //call proc & Create Table T1 //call proc & Create Table T2 //Perform Insert in Table T3 //Perform Insert in Table T4 -- This throws some kind of Exception e.g. SQLException } catch(ApplicationLevelException e) { sessionContext.setRollbackOnly();// to rollBack the inserts //call proc for Dropping the Tables created above throw e;// to rollBack() } catch(SQLException e) { // call proc for Dropping the Tables created above throw new EJBException();// to rollBack() } }// end method A() Whenever any DML Statement is executed, it will implicitly commit all the previous DML's, if any. e.g. Inserts Hence, the problem with above is that once you call procedure for dropping Tables (which is considered as a DML) , it will automatically commit the Insert in Table T3. Is there any way in which I can perform RollkBack() for Insert in T3 and also Drop the tables T1 and T2? Thanks.
Re: Perfroming RollBack() with DML's
Posted By: Christopher_Koenigsberg Posted On: Saturday, February 19, 2005 08:07 AM