Reputation: 103
What will happen if second transaction is rolled back (i.e. method3()) ? Will first transaction rollback?
// no transactional method
method1()
{
try{
method2(); // transactional
method3(); // transactional and fails due to exception
}
catch {
return "error message";
}
Upvotes: 3
Views: 146
Reputation: 36304
No, if method3()
fails, method2()
's transaction will NOT roll back because they are 2 different transactions.
Note : Even if method1 was transactional, it will not ensure atomicity of the whole operation (method2 + method3) because you are catching the exception.
Upvotes: 2