title: Catching DataAccessExceptions with AOP
body: <p>I have a webapp using Spring + Hibernate through JPA, Spring is effectively translating all persitence exceptions into variations of <code>DataAccessException</code>.</p>
  
  <p>I am now trying to catch these <code>DataAccessExceptions</code> in an AOP pointcut like this:</p>
  
  <pre><code>@Aspect
  public class AspectException {
  
  
      @AfterThrowing(pointcut = "within(com.mypackage.dao..*)", throwing = "error")
      public void catchException(Throwable error) {
        MyOwnException e = new MyOwnException("ERROR!", error);
         throw e;
      }
  }
  </code></pre>
  
  <p>Now this aspect works if in my DAO I throw a custom exception, but won't work with Spring's <code>DataAccessExceptions</code>!</p>
  
  <p>Any idea why this is happenning?</p>