Reputation: 120791
I am using Spring 3.0 with AspectJ and like use AspectJ more than AOP Proxies. That seams to work for almost every concern, but not for the Persistence Exception Translation. - My Question is how to use AspectJ for Persistence Exception Translation instead of Spring JDK AOP Proxies?
The relevant parts of my configuration are:
<context:spring-configured/>
...
<context:component-scan />
....
<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager" />
Upvotes: 2
Views: 637
Reputation: 298898
That should work out of the box if you compile against spring-aspects.jar. See org.springframework.orm.jpa.aspectj.JpaExceptionTranslatorAspect
for reference. Perhaps its pointcuts don't cover your scenario, in that case you need to extend the aspect with your own pointcuts. Here are the standard pointcuts included:
pointcut entityManagerCall(): call(* EntityManager.*(..))
|| call(* EntityManagerFactory.*(..))
|| call(* EntityTransaction.*(..))
|| call(* Query.*(..));
Upvotes: 1