Facebook
From Big Marmoset, 1 Year ago, written in Java.
Embed
Download Paste or View Raw
Hits: 30
  1. @Aspect
  2.     @Component
  3.     public class DatabaseRecordAspect {
  4.         @Pointcut("execution(org.eclipse.persistence.internal.sessions.AbstractRecord org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectOneRow())")
  5.         public void selectOneRow(){
  6.         }
  7.  
  8.         @Pointcut("execution(java.util.Vector org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows())")
  9.         public void selectAllRows(){
  10.         }
  11.  
  12.         @Around("selectOneRow() && this(expressionQueryMechanism)")
  13.         public AbstractRecord aroundSelectOneRow(ProceedingJoinPoint thisJoinPoint, ExpressionQueryMechanism expressionQueryMechanism) throws Throwable {
  14.             return new DatabaseRecordInterceptor().handleSelectOneRow(thisJoinPoint, expressionQueryMechanism);
  15.         }
  16.  
  17.         @Around("selectAllRows() && this(expressionQueryMechanism)")
  18.         public Vector aroundSelectAllRows(ProceedingJoinPoint thisJoinPoint, ExpressionQueryMechanism expressionQueryMechanism) throws Throwable {
  19.             return new DatabaseRecordInterceptor().handleSelectAllRows(thisJoinPoint, expressionQueryMechanism);
  20.         }
  21.     }
captcha