I call a service that has the following annotation:
@Transactional(rollbackFor=ExceptionA.class)
public void myMethodA(....) throws ExceptionA {
.
.
}
I am calling this method from another method in another Spring Bean.
@Transactional(rollbackFor=ExceptionB.class)
public void mainEntryPointMethod(....) throws ExceptionB {
.
try {
myMethodA()
}
catch (ExceptionA exp) {
.
}
.
}
My problem is that if myMethodA throws an exception, my transaction (which is passed from mainEntryPointMethod -> myMethodA by default) will be marked for rollback. Is there a way in which "rollbackFor" for an internal method can be overridden?
Thanks in advance Chris
source
share