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 <bal...@gmail.com> 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@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Attachment: smime.p7s
Description: S/MIME cryptographic signature

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

Reply via email to