Does Spring rollback on Runtime Exception when rollback for checked exception is specified in @Transactional annotation

981 views Asked by At

Given following @Transactional annotation defined on a class.

@Transactional(rollbackFor = CheckedException.class)

Will Spring still Rollback on thrown Unchecked (Runtime) exception plus the CheckedException.class? Or given the above annotation, will it rollback only for the listed Exceptions,i.e., CheckedException.class in this case?

1

There are 1 answers

0
Avinash On BEST ANSWER

Any runtime exception will always cause rollback, whether you mention a checked exception in rollbackFor or not.