2

I'm using Spring and Hibernate.

I have a class annotated as @Transactional and I want to be able to catch the exception generated by the Spring annotation without using a try catch block.

The exception is due to database connection loss.

I have many calls to methods on transactional classes and the process for managing the exception is always the same, so I just want something to call a method when an exception is raised.

Anyone knows how to do this?

Gust
  • 195
  • 1
  • 15

1 Answers1

0

I'd say to either use AspectJ AfterThrowing or customize your Annotation

Rollback on every checked exception

Community
  • 1
  • 1
Terry
  • 911
  • 10
  • 26