Search in sources :

Example 1 with SqmBetweenPredicate

use of org.hibernate.query.sqm.tree.predicate.SqmBetweenPredicate in project hibernate-orm by hibernate.

the class BaseSqmToSqlAstConverter method visitBetweenPredicate.

@Override
public BetweenPredicate visitBetweenPredicate(SqmBetweenPredicate predicate) {
    final FromClauseIndex fromClauseIndex = fromClauseIndexStack.getCurrent();
    final Expression expression;
    final Expression lowerBound;
    final Expression upperBound;
    inferrableTypeAccessStack.push(() -> coalesceSuppliedValues(() -> determineValueMapping(predicate.getLowerBound(), fromClauseIndex), () -> determineValueMapping(predicate.getUpperBound(), fromClauseIndex)));
    try {
        expression = (Expression) predicate.getExpression().accept(this);
    } finally {
        inferrableTypeAccessStack.pop();
    }
    inferrableTypeAccessStack.push(() -> coalesceSuppliedValues(() -> determineValueMapping(predicate.getExpression(), fromClauseIndex), () -> determineValueMapping(predicate.getUpperBound(), fromClauseIndex)));
    try {
        lowerBound = (Expression) predicate.getLowerBound().accept(this);
    } finally {
        inferrableTypeAccessStack.pop();
    }
    inferrableTypeAccessStack.push(() -> coalesceSuppliedValues(() -> determineValueMapping(predicate.getExpression(), fromClauseIndex), () -> determineValueMapping(predicate.getLowerBound(), fromClauseIndex)));
    try {
        upperBound = (Expression) predicate.getUpperBound().accept(this);
    } finally {
        inferrableTypeAccessStack.pop();
    }
    return new BetweenPredicate(expression, lowerBound, upperBound, predicate.isNegated(), getBooleanType());
}
Also used : BetweenPredicate(org.hibernate.sql.ast.tree.predicate.BetweenPredicate) SqmBetweenPredicate(org.hibernate.query.sqm.tree.predicate.SqmBetweenPredicate) BinaryArithmeticExpression(org.hibernate.sql.ast.tree.expression.BinaryArithmeticExpression) SqmModifiedSubQueryExpression(org.hibernate.query.sqm.tree.expression.SqmModifiedSubQueryExpression) SelfRenderingFunctionSqlAstExpression(org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression) SelfRenderingAggregateFunctionSqlAstExpression(org.hibernate.query.sqm.function.SelfRenderingAggregateFunctionSqlAstExpression) CaseSearchedExpression(org.hibernate.sql.ast.tree.expression.CaseSearchedExpression) SelfRenderingSqlFragmentExpression(org.hibernate.sql.ast.tree.expression.SelfRenderingSqlFragmentExpression) Expression(org.hibernate.sql.ast.tree.expression.Expression) SelfRenderingExpression(org.hibernate.sql.ast.tree.expression.SelfRenderingExpression) SqmExpression(org.hibernate.query.sqm.tree.expression.SqmExpression) CaseSimpleExpression(org.hibernate.sql.ast.tree.expression.CaseSimpleExpression) SqlSelectionExpression(org.hibernate.sql.ast.tree.expression.SqlSelectionExpression) ModifiedSubQueryExpression(org.hibernate.sql.ast.tree.expression.ModifiedSubQueryExpression)

Aggregations

SelfRenderingAggregateFunctionSqlAstExpression (org.hibernate.query.sqm.function.SelfRenderingAggregateFunctionSqlAstExpression)1 SelfRenderingFunctionSqlAstExpression (org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression)1 SqmExpression (org.hibernate.query.sqm.tree.expression.SqmExpression)1 SqmModifiedSubQueryExpression (org.hibernate.query.sqm.tree.expression.SqmModifiedSubQueryExpression)1 SqmBetweenPredicate (org.hibernate.query.sqm.tree.predicate.SqmBetweenPredicate)1 BinaryArithmeticExpression (org.hibernate.sql.ast.tree.expression.BinaryArithmeticExpression)1 CaseSearchedExpression (org.hibernate.sql.ast.tree.expression.CaseSearchedExpression)1 CaseSimpleExpression (org.hibernate.sql.ast.tree.expression.CaseSimpleExpression)1 Expression (org.hibernate.sql.ast.tree.expression.Expression)1 ModifiedSubQueryExpression (org.hibernate.sql.ast.tree.expression.ModifiedSubQueryExpression)1 SelfRenderingExpression (org.hibernate.sql.ast.tree.expression.SelfRenderingExpression)1 SelfRenderingSqlFragmentExpression (org.hibernate.sql.ast.tree.expression.SelfRenderingSqlFragmentExpression)1 SqlSelectionExpression (org.hibernate.sql.ast.tree.expression.SqlSelectionExpression)1 BetweenPredicate (org.hibernate.sql.ast.tree.predicate.BetweenPredicate)1