I know that if an EJB method throws a checked exception there is no transaction rollback.
But is there a way to force the rollback when there is a checked exception without having to call setRollbackOnly()
in each method or create my own Exception class annotated with @ApplicationException(rollback=true)
?
Currently all our EJB methods are throwing Exception (mymethod() throws Exception
) and we would like to apply a quick fix to have transaction rollback when this kind of exception is thrown without having to modify each method signature.
Is it possible by modifying a parameter on the application server (currently using Jboss AS 7.1.1), using an annotation on my EJB classes or by defining some kind of interceptor ?
Thanks for any help ;)