Hi,
I am inserting the data into six tables under single transaction scope. Basically, if any errors occur it should role back the complete transaction.
My question is Can I use entity beans (CMP) and DAO based Stored Procedure calls from a session bean, both in a single transaction?
Right now even though there are problems with some of the procedure calls, the transaction scope is not working and didn�t role back.
I have tried many methods, including using java.sql.Connection based trasactions, CMT based trasactions (i.e. allowing the container to handle the trasactions) and finally using BMT in the session bean and CMT for the entity beans. All the same i am still faced with this problem.
Here is my code for the last of these options.
try{
ut = ejbContext.getUserTransaction();
ut.begin();
// Insert data into Course Table
insertCourse(courseRequestDTO);
// Insert data into CourseSession table
insertCourseSession(courseRequestDTO);
// Insert data into Course Request table
insertExternalInfo(courseRequestDTO);
// Insert data into Manager Table
insertManager(courseRequestDTO);
// Insert data into Employee table by Using CMP
insertEmployee(employeeDTO, courseRequestDTO);
//Insert data into CourseRequest Table
insertCourseRequest(courseRequestDTO);
ut.commit();
}
catch(SQLException se){
ut.rollback();
System.out.println("<<<< Transaction failed >>>>>");
}
<b>Can anyone help me on this ?</b>
Thanks and Regards
<b>Kamran</b>
<email>
Kamranzaidi@hotmail.com</email>