|
|
Problem with @Transactional rollbackFor
Hi all,
I am currently stuck with the following problem. My method is marked with the @Transactional annotation. So far so good. However, I want to rollback only for a particular kind of exception. The following is my scenario:
@Transactional(rollbackFor=ExceptionA.class)
public void myMethod(...) throws ExceptionA {
. . try {
// Something goes wrong here ... and throws ExceptionB. } catch (Exception B) {
// ExceptionB gets handled } . .
}My problem is that even though in my code ExceptionA is never thrown, when ExceptionB is thrown, the transaction is 'marked' for rollback just the same.
PS: ExceptionB is not a subclass of ExceptionA.
Can anyone provide some help?
Thanks
Chris |
|