@Aspect @Component public class DatabaseRecordAspect { @Pointcut("execution(org.eclipse.persistence.internal.sessions.AbstractRecord org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectOneRow())") public void selectOneRow(){ } @Pointcut("execution(java.util.Vector org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows())") public void selectAllRows(){ } @Around("selectOneRow() && this(expressionQueryMechanism)") public AbstractRecord aroundSelectOneRow(ProceedingJoinPoint thisJoinPoint, ExpressionQueryMechanism expressionQueryMechanism) throws Throwable { return new DatabaseRecordInterceptor().handleSelectOneRow(thisJoinPoint, expressionQueryMechanism); } @Around("selectAllRows() && this(expressionQueryMechanism)") public Vector aroundSelectAllRows(ProceedingJoinPoint thisJoinPoint, ExpressionQueryMechanism expressionQueryMechanism) throws Throwable { return new DatabaseRecordInterceptor().handleSelectAllRows(thisJoinPoint, expressionQueryMechanism); } }