Search in sources :

Example 1 with LikePredicate

use of org.hibernate.sql.ast.tree.predicate.LikePredicate in project hibernate-orm by hibernate.

the class ExpressionReplacementWalker method visitLikePredicate.

@Override
public void visitLikePredicate(LikePredicate likePredicate) {
    final Expression matchExpression = replaceExpression(likePredicate.getMatchExpression());
    final Expression patternExpression = replaceExpression(likePredicate.getPattern());
    final Expression escapeExpression = likePredicate.getEscapeCharacter() == null ? null : replaceExpression(likePredicate.getEscapeCharacter());
    if (matchExpression != likePredicate.getMatchExpression() || patternExpression != likePredicate.getPattern() || escapeExpression != likePredicate.getEscapeCharacter()) {
        returnedNode = new LikePredicate(matchExpression, patternExpression, escapeExpression, likePredicate.isNegated(), likePredicate.isCaseSensitive(), likePredicate.getExpressionType());
    } else {
        returnedNode = likePredicate;
    }
}
Also used : Expression(org.hibernate.sql.ast.tree.expression.Expression) CaseSimpleExpression(org.hibernate.sql.ast.tree.expression.CaseSimpleExpression) BinaryArithmeticExpression(org.hibernate.sql.ast.tree.expression.BinaryArithmeticExpression) SqlSelectionExpression(org.hibernate.sql.ast.tree.expression.SqlSelectionExpression) CaseSearchedExpression(org.hibernate.sql.ast.tree.expression.CaseSearchedExpression) ModifiedSubQueryExpression(org.hibernate.sql.ast.tree.expression.ModifiedSubQueryExpression) SelfRenderingExpression(org.hibernate.sql.ast.tree.expression.SelfRenderingExpression) LikePredicate(org.hibernate.sql.ast.tree.predicate.LikePredicate)

Aggregations

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 SqlSelectionExpression (org.hibernate.sql.ast.tree.expression.SqlSelectionExpression)1 LikePredicate (org.hibernate.sql.ast.tree.predicate.LikePredicate)1