Hi all,
I have this question regarding rolling back and I thought it is handled by Transaction Manager of the EJB 3.0 but it doesnot seem so.
The problem is I have method in a Stateless session bean that trying to remove some rows in 1 table first and and then insert some rows in the other table. I want to make sure if the insertion failed in the second step, all of those removals would be rolled back. I use the EntityManager to do the delete and insert. Here are the pseudocode of my method
void updateDB (){
removeRows();
addRows();
}
void removeRows(){
//use EntityManager to remove
}
void addRows(){
//use EntityManager to insert some rows
}
Could anyone tell me how to make sure if the call to addRows failed, such as insert a duplicate row, would cause the removeRows rolledback?
Thank you very much in advance,
LNgo