Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Pointcut not being executed...

It works. Thanks a lot to both of you.
I've just ordered the "AspectJ in action" book that will help get started with AspectJ because I am quite a beginner in AspectJ as you can see. 
Regards,
J.

2012/8/2 Romain MULLER <romain.muller@xxxxxxxxx>
EntityManager.persist() accepts an Obect argument. This static typing is all that AspectJ will look at. You will have to intercept *all* calls to the method, regardless of the argument type, then inspect thisJoinPoint.getArgs()[0] to see if it's the type you're looking for, and acting if it is the case.

_________________________
Sent over RFC-1149 compliant transport - please excuse occasionnal packet loss

Le 2 août 2012 à 17:44, Julien Martin <balteo@xxxxxxxxx> a écrit :

Hello,

I mean to intercept only calls of EntityManager.persist when the argument is of type trc.suivi.domain.Pli

I have tried the following code:

pointcut catchIt(Pli pli) : (call(* javax.persistence.EntityManager.persist(trc.suivi.domain.Pli)));
after(Pli pli) returning: catchIt(pli) {
log.debug("catchIt");
Evenement ev = new Evenement();
ev.setDateCreation(new Date());
ev.setIdObjetProprietaire(pli.getId());
evenementRepository.save(ev);
}

and nothing happens.

Can anyone please help?

Regards,

J.
_______________________________________________

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top