Thursday, July 7, 2011

AOP – Spring – JPA for background threads / jobs

[See this post in the new blog]

I've recently come up to a very wicked problem in Syncope, and a saving blog post pointed me in the right direction:

Getting your persistence access right when working with background jobs in Spring can be tricky. Most people rely on the Open Session In View pattern using Filters or Interceptors that act on the regular app server threads and close and open sessions for each request.

Nevertheless, I had to refactor a bit the source code to be JPA 2.0 (and not strictly Hibernate) compliant: the result is available here. I have also added some @Transactional support.