/** * Creates a new EclipseLink {@link Expression} by visiting the given JPQL {@link * StateFieldPathExpression}. This method temporarily changes the null allowed flag if the state * field is a foreign reference mapping * * @param expression The {@link StateFieldPathExpression} to convert into an EclipseLink {@link * Expression} * @return The EclipseLink {@link Expression} representation of that path expression */ Expression buildModifiedPathExpression(StateFieldPathExpression expression) { try { PathResolver resolver = new PathResolver(); resolver.length = expression.pathSize(); resolver.checkMappingType = true; expression.accept(resolver); return resolver.localExpression; } finally { this.type[0] = null; this.queryExpression = null; } }
/** * Creates a new EclipseLink {@link Expression} by visiting the given JPQL {@link * StateFieldPathExpression}. This method temporarily changes the null allowed flag if the state * field is a foreign reference mapping * * @param expression The {@link StateFieldPathExpression} to convert into an EclipseLink {@link * Expression} * @return The EclipseLink {@link Expression} representation of that path expression */ Expression buildModifiedPathExpression(StateFieldPathExpression expression) { try { PathResolver resolver = new PathResolver(); resolver.length = expression.pathSize(); resolver.checkMappingType = true; expression.accept(resolver); return resolver.localExpression; } finally { this.type[0] = null; this.queryExpression = null; } }
/** * {@link InputParameter} */ @Override public void visit(IdentificationVariable expression) { // Check to see if the identification variable is "virtual" and internally // changed to a state field path expression. If so, it means it's an unqualified // path found in an UPDATE or DELETE query StateFieldPathExpression pathExpression = expression.isVirtual() ? expression.getStateFieldPathExpression() : null; if (pathExpression != null) { pathExpression.accept(this); } else { Declaration declaration = queryContext.findDeclaration(expression.getVariableName()); // A null declaration Expression would mean it's the first package of an enum type if (declaration != null) { descriptor = declaration.getDescriptor(); } } }
/** * {@link InputParameter} */ @Override public void visit(IdentificationVariable expression) { // Check to see if the identification variable is "virtual" and internally // changed to a state field path expression. If so, it means it's an unqualified // path found in an UPDATE or DELETE query StateFieldPathExpression pathExpression = expression.isVirtual() ? expression.getStateFieldPathExpression() : null; if (pathExpression != null) { pathExpression.accept(this); } else { Declaration declaration = queryContext.findDeclaration(expression.getVariableName()); // A null declaration Expression would mean it's the first package of an enum type if (declaration != null) { descriptor = declaration.getDescriptor(); } } }
pathExpression.accept(this);
pathExpression.accept(this);
stateFieldPathExpression.accept(this); return;
stateFieldPathExpression.accept(this); return;