So your problem might be that classes in javax.* aren't woven. It could also be that the EntityManager method you're calling is actually not defined in javax.persistence.EntityManager itself, but by a subclass thereof, in which case you'd use the following pointcut instead:
execution(* javax.persistence.EntityManager+.persist(..)); [ Romain Muller | Software Development Engineer | +33 (0)6 48 25 66 70 | romain.mul...@esial.net ] Le 2 août 2012 à 15:55, Julien Martin a écrit : > Using "call" works and "execution" does not. > Thanks a lot Romain! > > 2012/8/2 Romain Muller <romain.mul...@esial.net> > Have you tried switching your pointcut from "execution" to "call" and see if > that works any better? > > [ Romain Muller | Software Development Engineer | +33 (0)6 48 25 66 70 | > romain.mul...@esial.net ] > > Le 2 août 2012 à 15:49, Julien Martin a écrit : > >> Hello, >> >> I am trying to advise javax.persistence.EntityManager with AspectJ and >> Spring. It just does not work: no error and no "caught" on the console... >> >> Here is my aspect: >> >> package trc.suivi.aspects; >> >> >> >> public aspect EventManagerAspect { >> >> >> >> public EventManagerAspect() {} >> >> >> >> pointcut catchIt() : (execution(* >> javax.persistence.EntityManager.persist(..))); >> >> >> >> after() returning: catchIt() { >> >> >> System.out.println("caught"); >> >> >> } >> >> >> >> } >> >> >> Here is how I configured my aspect in Spring: >> >> <bean class="trc.suivi.aspects.EventManagerAspect" >> factory-method="aspectOf"/> >> Can anyone please help? >> Regards, >> Julien. >> _______________________________________________ >> aspectj-users mailing list >> aspectj-users@eclipse.org >> https://dev.eclipse.org/mailman/listinfo/aspectj-users > > > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > > _______________________________________________ > aspectj-users mailing list > aspectj-users@eclipse.org > https://dev.eclipse.org/mailman/listinfo/aspectj-users
_______________________________________________ aspectj-users mailing list aspectj-users@eclipse.org https://dev.eclipse.org/mailman/listinfo/aspectj-users