I have methodA calling methodB. MethodB throwing some exception. What i want even if there some exception in methodB there is no rollback . I can not change methodB. Is there a way to handle at methodA level ?
@Transactional(noRollbackFor = Exception.class)
methodA() {
...
try {
for(Employee emp : employees){
methodB();
}
} catch (...) {...}
log("OK");
}
@Transactional
methodB() {
// some exception is thrown
}
There is similar thread at Transaction marked as rollback only: How do I find the cause but looks like accepeted answer handled it at methodB level instead of calling method ?