public String getPath() { return toString(); }
public String getPath() { return toString(); }
@Override public void visit(PathExpression expression) { if (expression.getBaseNode() == null) { ((SelectInfo) aliasManager.getAliasInfo(expression.toString())).getExpression().accept(this); } else { expressions.add(expression); } }
String expressionString = expression.toString();
@Override public void visit(PathExpression expr) { JoinNode node = (JoinNode) expr.getBaseNode(); if (node == null) { // This can only be a select alias ((SelectInfo) aliasManager.getAliasInfo(expr.toString())).getExpression().accept(this); } else { node.updateClauseDependencies(ClauseType.GROUP_BY); } }
@Override public Boolean visit(PathExpression expression) { if (expression.getBaseNode() == null) { return ((SelectInfo) aliasManager.getAliasInfo(expression.toString())).getExpression().accept(this); } else { return baseExpression(expression); } }
PathReference pathReference = expr.getPathReference(); if (pathReference == null) { ((SelectInfo) aliasManager.getAliasInfo(expr.toString())).getExpression().accept(this); return;
private void visit(PathExpression expression, boolean idRemovable) { Expression aliasedExpression; String alias; if (expression.getExpressions().size() == 1 && !currentlyResolvingAliases.contains(alias = expression.toString()) && (aliasedExpression = joinManager.getJoinableSelectAlias(expression, fromClause == ClauseType.SELECT, false)) != null) { try { currentlyResolvingAliases.add(alias);
throw new ExternalAliasDereferencingException("Start alias [" + startAlias + "] of path [" + path.toString() + "] is external and must not be dereferenced");
@Override public void visit(PathExpression expression) { AliasInfo aliasInfo = aliasManager.getAliasInfo(expression.toString()); if (aliasInfo != null && aliasInfo instanceof SelectInfo) { ((SelectInfo) aliasInfo).getExpression().accept(this); } else if (inSubquery) { JoinNode joinNode = (JoinNode) expression.getBaseNode(); if (joinNode != null && joinNode.getAliasInfo().getAliasOwner() == aliasManager) { // we have an external path in the subquery while (joinNode != null && joinNode.getParentTreeNode() != null) { if (joinNode.getParentTreeNode().isCollection()) { throw new IllegalStateException("Unsupported external collection access [" + joinNode.getAliasInfo().getAbsolutePath() + "]"); } joinNode = joinNode.getParent(); } } } }
throw new RuntimeException("Path [" + sizeArg.toString() + "] does not refer to a collection");
@Override public Expression visit(PathExpression expression) { if (expression.getBaseNode() == null) { Expression aliasedExpression = ((SelectInfo) aliasManager.getAliasInfo(expression.toString())).getExpression(); Expression newExpression = aliasedExpression.accept(this); return aliasedExpression == newExpression ? expression : newExpression; } if (expression == expressionToSplit) { List<PathElementExpression> expressions = new ArrayList<>(expression.getExpressions()); for (String subAttributePart : subAttribute.split("\\.")) { expressions.add(new PropertyExpression(subAttributePart)); } String field; if (expression.getField() == null) { field = subAttribute; } else { field = expression.getField() + "." + subAttribute; } JoinNode node = (JoinNode) expression.getBaseNode(); Class<?> fieldClass = jpaProvider.getJpaMetamodelAccessor().getAttributePath(metamodel, node.getManagedType(), field).getAttributeClass(); Type<?> fieldType = metamodel.type(fieldClass); return new PathExpression( expressions, new SimplePathReference(node, field, fieldType), expression.isUsedInCollectionFunction(), expression.isCollectionKeyPath() ); } return expression; }
String alias; if (pathExpression.getExpressions().size() == 1 && !currentlyResolvingAliases.contains(alias = pathExpression.toString()) && (aliasedExpression = getJoinableSelectAlias(pathExpression, fromClause == ClauseType.SELECT, fromSubquery)) != null) {
@Override public Boolean visit(MapKeyExpression expression) { PathExpression path = expression.getPath(); PathReference pathReference = path.getPathReference(); while (pathReference == null) { Expression aliasedExpression = ((SelectInfo) aliasManager.getAliasInfo(path.toString())).getExpression(); if (aliasedExpression instanceof PathExpression) { path = (PathExpression) aliasedExpression; pathReference = path.getPathReference(); } else { // This should never happen return false; } } JoinNode baseNode = (JoinNode) pathReference.getBaseNode(); Attribute attr; if (baseNode.getParentTreeNode() != null) { attr = baseNode.getParentTreeNode().getAttribute(); if (attr instanceof MapAttribute<?, ?, ?> && ((MapAttribute<?, ?, ?>) attr).getKeyType() instanceof EmbeddableType<?>) { expressionToSplit = expression; } } return false; }
PathReference pathReference = expr.getPathReference(); if (pathReference == null) { return ((SelectInfo) aliasManager.getAliasInfo(expr.toString())).getExpression().accept(this);
PathReference pathReference = expr.getPathReference(); if (pathReference == null) { Expression aliasedExpression = ((SelectInfo) aliasManager.getAliasInfo(expr.toString())).getExpression(); return aliasedExpression.accept(this);