2

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?

Jobin
  • 5,610
  • 5
  • 38
  • 53
Nehal Damania
  • 8,671
  • 9
  • 37
  • 52

1 Answers1

1

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

Avinash
  • 4,115
  • 2
  • 22
  • 41