java.lang.Object
org.springframework.data.relational.core.sql.Conditions

public abstract class Conditions extends Object
Factory for common Conditions.
Since:
1.1
Author:
Mark Paluch, Jens Schauder, Meng Zuozhu, Daniele Canteri
See Also:
  • Method Details

    • just

      public static Condition just(String sql)
      Creates a plain sql Condition.
      Parameters:
      sql - the SQL, must not be null or empty.
      Returns:
      a SQL Expression.
    • nest

      public static Condition nest(Condition condition)
      Creates a nested Condition that is enclosed with parentheses. Useful to combine AND and OR statements.
      Parameters:
      condition - the nested condition.
      Returns:
      a NestedCondition.
      Since:
      2.0
    • not

      public static Condition not(Condition condition)
      Creates a NOT Condition that reverses the condition.
      Parameters:
      condition - the condition to NOT.
      Returns:
      a NOT Condition.
      Since:
      3.1.6
    • isNull

      public static IsNull isNull(Expression expression)
      Creates a IS NULL condition.
      Parameters:
      expression - the expression to check for nullability, must not be null.
      Returns:
      the IS NULL condition.
    • isEqual

      public static Comparison isEqual(Expression leftColumnOrExpression, Expression rightColumnOrExpression)
      Creates a = (equals) Condition.
      Parameters:
      leftColumnOrExpression - left side of the comparison.
      rightColumnOrExpression - right side of the comparison.
      Returns:
      the Comparison condition.
    • isNotEqual

      public static Comparison isNotEqual(Expression leftColumnOrExpression, Expression rightColumnOrExpression)
      Creates a != (not equals) Condition.
      Parameters:
      leftColumnOrExpression - left side of the comparison.
      rightColumnOrExpression - right side of the comparison.
      Returns:
      the Comparison condition.
    • between

      public static Between between(Expression columnOrExpression, Expression begin, Expression end)
      Creates a BETWEEN Condition.
      Parameters:
      columnOrExpression - left side of the comparison.
      begin - begin value of the comparison.
      end - end value of the comparison.
      Returns:
      the Comparison condition.
      Since:
      2.0
    • notBetween

      public static Between notBetween(Expression columnOrExpression, Expression begin, Expression end)
      Creates a NOT BETWEEN Condition.
      Parameters:
      columnOrExpression - left side of the comparison.
      begin - begin value of the comparison.
      end - end value of the comparison.
      Returns:
      the Comparison condition.
      Since:
      2.0
    • isLess

      public static Comparison isLess(Expression leftColumnOrExpression, Expression rightColumnOrExpression)
      Creates a < (less) Condition comparing left is less than right.
      Parameters:
      leftColumnOrExpression - left side of the comparison.
      rightColumnOrExpression - right side of the comparison.
      Returns:
      the Comparison condition.
    • isLessOrEqualTo

      public static Comparison isLessOrEqualTo(Expression leftColumnOrExpression, Expression rightColumnOrExpression)
      Creates a <= (less or equal to) Condition comparing left is less than or equal to right.
      Parameters:
      leftColumnOrExpression - left side of the comparison.
      rightColumnOrExpression - right side of the comparison.
      Returns:
      the Comparison condition.
    • isGreater

      public static Comparison isGreater(Expression leftColumnOrExpression, Expression rightColumnOrExpression)
      Creates a <= (greater ) Condition comparing left is greater than right.
      Parameters:
      leftColumnOrExpression - left side of the comparison.
      rightColumnOrExpression - right side of the comparison.
      Returns:
      the Comparison condition.
    • isGreaterOrEqualTo

      public static Comparison isGreaterOrEqualTo(Expression leftColumnOrExpression, Expression rightColumnOrExpression)
      Creates a <= (greater or equal to) Condition comparing left is greater than or equal to right.
      Parameters:
      leftColumnOrExpression - left side of the comparison.
      rightColumnOrExpression - right side of the comparison.
      Returns:
      the Comparison condition.
    • like

      public static Like like(Expression leftColumnOrExpression, Expression rightColumnOrExpression)
      Creates a LIKE Condition.
      Parameters:
      leftColumnOrExpression - left side of the comparison.
      rightColumnOrExpression - right side of the comparison.
      Returns:
      the Comparison condition.
    • notLike

      public static Like notLike(Expression leftColumnOrExpression, Expression rightColumnOrExpression)
      Creates a NOT LIKE Condition.
      Parameters:
      leftColumnOrExpression - left side of the comparison.
      rightColumnOrExpression - right side of the comparison.
      Returns:
      the Comparison condition.
      Since:
      2.0
    • in

      public static In in(Expression columnOrExpression, Expression arg)
      Creates a IN clause.
      Parameters:
      columnOrExpression - left side of the comparison.
      arg - IN argument.
      Returns:
      the In condition.
    • in

      public static Condition in(Expression columnOrExpression, Collection<? extends Expression> expressions)
      Creates a new In Condition given left and right Expressions.
      Parameters:
      columnOrExpression - left hand side of the Condition must not be null.
      expressions - right hand side (collection Expression) must not be null.
      Returns:
      the In Condition.
    • in

      public static In in(Expression columnOrExpression, Expression... expressions)
      Creates a new In Condition given left and right Expressions.
      Parameters:
      columnOrExpression - left hand side of the Condition must not be null.
      expressions - right hand side (collection Expression) must not be null.
      Returns:
      the In Condition.
    • in

      public static In in(Column column, Select subselect)
      Creates a IN clause for a subselect.
      Parameters:
      column - the column to compare.
      subselect - the subselect.
      Returns:
      the In condition.
    • notIn

      public static In notIn(Expression columnOrExpression, Expression arg)
      Creates a NOT IN clause.
      Parameters:
      columnOrExpression - left side of the comparison.
      arg - IN argument.
      Returns:
      the In condition.
    • notIn

      public static Condition notIn(Expression columnOrExpression, Collection<? extends Expression> expressions)
      Creates a new NOT IN Condition given left and right Expressions.
      Parameters:
      columnOrExpression - left hand side of the Condition must not be null.
      expressions - right hand side (collection Expression) must not be null.
      Returns:
      the In Condition.
    • notIn

      public static In notIn(Expression columnOrExpression, Expression... expressions)
      Creates a new NOT IN Condition given left and right Expressions.
      Parameters:
      columnOrExpression - left hand side of the Condition must not be null.
      expressions - right hand side (collection Expression) must not be null.
      Returns:
      the NOT IN Condition.
    • notIn

      public static In notIn(Column column, Select subselect)
      Creates a NOT IN clause for a subselect.
      Parameters:
      column - the column to compare.
      subselect - the subselect.
      Returns:
      the NOT IN condition.