Tips for Debugging Spring's @Transactional Annotation - Tim Mattison
For over a week now I've been cleaning up some legacy code that uses Spring and Hibernate to persist and process data in a SQL database. The code works but it doesn't follow the strict philosophy of service oriented architecture in the sense that there are several places that Spring and Hibernate weren't doing what they were expected to do and a few workarounds had to be implemented. Since we were bringing more programmers on board I wanted to make sure that everything played by the rules and was easy to update so I had to learn a lot that I had glossed over in the past.
With some creative Googling I found two invaluable resources that I need to give credit to:
Here's what I distilled out of everything I went through:
@Transactional annotations only work on public methods. If you have a private or protected method with this annotation there's no (easy) way for Spring AOP to see the annotation. It doesn't go crazy trying to find them so make sure all of your annotated methods are public.
Read full article from Tips for Debugging Spring's @Transactional Annotation - Tim Mattison
No comments:
Post a Comment