The project used Spring + Hibernate
Sample code:
public void method(){
try{
dao.saveA(entityA);
//condition may be throw RuntimeException;
dao.saveB(entityB);
}catch(RuntimeException e){
throw e;
}finally{
dao.saveC(entityC)
}
}
Finally, just entityC will be saved in database in test.
I think saveA, saveB, saveC in the same transaction,they should not be committed.
In this case, I want to know why entityC is committed.
How does Spring do this in the finally block?
//-------------------------//
Actually, my question is that:how spring ensure the transaction committed in the finally block .
will Spring be get a new connection in the finally block?