use of org.hibernate.sql.ast.tree.expression.Expression in project hibernate-orm by hibernate.
the class AbstractSqlAstTranslator method renderCommaSeparatedSelectExpression.
protected final void renderCommaSeparatedSelectExpression(Iterable<? extends SqlAstNode> expressions) {
String separator = NO_SEPARATOR;
for (SqlAstNode expression : expressions) {
final SqlTuple sqlTuple = SqlTupleContainer.getSqlTuple(expression);
if (sqlTuple != null) {
for (Expression e : sqlTuple.getExpressions()) {
appendSql(separator);
renderSelectExpression(e);
separator = COMA_SEPARATOR;
}
} else if (expression instanceof Expression) {
appendSql(separator);
renderSelectExpression((Expression) expression);
} else {
appendSql(separator);
expression.accept(this);
}
separator = COMA_SEPARATOR;
}
}
use of org.hibernate.sql.ast.tree.expression.Expression in project hibernate-orm by hibernate.
the class AbstractSqlAstWalker method visitQuerySpec.
@Override
public void visitQuerySpec(QuerySpec querySpec) {
querySpec.getSelectClause().accept(this);
querySpec.getFromClause().accept(this);
if (querySpec.getWhereClauseRestrictions() != null) {
querySpec.getWhereClauseRestrictions().accept(this);
}
for (Expression groupByClauseExpression : querySpec.getGroupByClauseExpressions()) {
groupByClauseExpression.accept(this);
}
if (querySpec.getHavingClauseRestrictions() != null) {
querySpec.getHavingClauseRestrictions().accept(this);
}
visitOffsetFetchClause(querySpec);
}
use of org.hibernate.sql.ast.tree.expression.Expression in project hibernate-orm by hibernate.
the class ExpressionReplacementWalker method visitRelationalPredicate.
@Override
public void visitRelationalPredicate(ComparisonPredicate comparisonPredicate) {
final Expression lhs = replaceExpression(comparisonPredicate.getLeftHandExpression());
final Expression rhs = replaceExpression(comparisonPredicate.getRightHandExpression());
if (lhs != comparisonPredicate.getLeftHandExpression() || rhs != comparisonPredicate.getRightHandExpression()) {
returnedNode = new ComparisonPredicate(lhs, comparisonPredicate.getOperator(), rhs, comparisonPredicate.getExpressionType());
} else {
returnedNode = comparisonPredicate;
}
}
use of org.hibernate.sql.ast.tree.expression.Expression in project hibernate-orm by hibernate.
the class ExpressionReplacementWalker method visitBetweenPredicate.
@Override
public void visitBetweenPredicate(BetweenPredicate betweenPredicate) {
final Expression expression = replaceExpression(betweenPredicate.getExpression());
final Expression lowerBound = replaceExpression(betweenPredicate.getLowerBound());
final Expression upperBound = replaceExpression(betweenPredicate.getUpperBound());
if (expression != betweenPredicate.getExpression() || lowerBound != betweenPredicate.getLowerBound() || upperBound != betweenPredicate.getUpperBound()) {
returnedNode = new BetweenPredicate(expression, lowerBound, upperBound, betweenPredicate.isNegated(), betweenPredicate.getExpressionType());
} else {
returnedNode = betweenPredicate;
}
}
use of org.hibernate.sql.ast.tree.expression.Expression in project hibernate-orm by hibernate.
the class ExpressionReplacementWalker method visitInSubQueryPredicate.
@Override
public void visitInSubQueryPredicate(InSubQueryPredicate inSubQueryPredicate) {
final Expression testExpression = replaceExpression(inSubQueryPredicate.getTestExpression());
final QueryPart subQuery = replaceExpression(inSubQueryPredicate.getSubQuery());
if (testExpression != inSubQueryPredicate.getTestExpression() || subQuery != inSubQueryPredicate.getSubQuery()) {
returnedNode = new InSubQueryPredicate(testExpression, subQuery, inSubQueryPredicate.isNegated(), inSubQueryPredicate.getExpressionType());
} else {
returnedNode = inSubQueryPredicate;
}
}
Aggregations