title: How to write a pointcut to get an operation on a class method?
body: <p>I have a class named PersonDAOImpl, where I use Hibernate to persist data on my data base. </p>
  
  <p>In order to audit the class, I created another class using the @Aspect annotation, where I declared some Pointcuts and Advices. Everytime I insert, update or delete a person, I'm able to store on a table proper information about the operation executed. </p>
  
  <p>However now I have more DAO classes, and I don't want to create more Aspects classes or more Advices for every method on every DAO. Instead, I want to "capture" the operations of persist(), update() or delete() in a single pointcut. </p>
  
  <p>For example I have this method on my DAO:</p>
  
  <pre><code>@Override
  @Transactional
  public void addPerson(Person p) {
      Session session = this.sessionFactory.getCurrentSession();
      session.persist(p);
      session.flush();
      logger.info("Person saved successfully, Person Details="+p);
  }
  </code></pre>
  
  <p>And this is how I audit the insertions: </p>
  
  <pre><code>@Pointcut("execution(* com.dacasals.raspertwo.dao.PersonDAOImpl.addPerson(..))")
  public void addNewPerson() {
  }
  
  @After("addNewPerson()")
  public void aP() {
      System.out.println("added a new person");
      operation = "Insert";
      date = Calendar.getInstance().getTime();
      register(operation, date);
  }
  </code></pre>
  
  <p>But I want something like @Pointcut("execution(*com.dacasals.raspertwo.dao.anydaoclass.anymethod.persist(..))")</p>
  
  <p>I mean a pointcut for any method on any of my DAO classes where persist() is called. Same thing for update() and delete(). </p>
  
  <p>How can I achieve this? I've tried with 'within' and 'withincode' but nothing happens. Thanks in advance.</p>