transactions icon indicating copy to clipboard operation
transactions copied to clipboard

Clarify whether rollbackOn accepts Throwables and improve typesafety

Open gavinking opened this issue 8 months ago • 6 comments

It's unclear from the spec and Javadoc whether an "exception" specified by rollbackOn or dontRollbackOn must descend from Exception, or whether it may be any sort of Throwable. This problem is made far worse because these annotations members are not type safe, and declared using raw types, allowing the user to write nonsensical things like @Transactional(rollbackOn=Object.class).

It should be clarified whether stuff like @Transactional(rollbackOn=Error.class) is allowed, and the annotation members should be fixed to have a correct upper bound on the Class type.

gavinking avatar May 03 '25 16:05 gavinking