Class Conditions
java.lang.Object
org.springframework.data.relational.core.sql.Conditions
Factory for common
Condition
s.- Since:
- 1.1
- Author:
- Mark Paluch, Jens Schauder, Meng Zuozhu, Daniele Canteri
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic Between
between
(Expression columnOrExpression, Expression begin, Expression end) Creates aBETWEEN
Condition
.static In
static Condition
in
(Expression columnOrExpression, Collection<? extends Expression> expressions) static In
in
(Expression columnOrExpression, Expression arg) Creates aIN
clause
.static In
in
(Expression columnOrExpression, Expression... expressions) static Comparison
isEqual
(Expression leftColumnOrExpression, Expression rightColumnOrExpression) Creates a=
(equals)Condition
.static Comparison
isGreater
(Expression leftColumnOrExpression, Expression rightColumnOrExpression) static Comparison
isGreaterOrEqualTo
(Expression leftColumnOrExpression, Expression rightColumnOrExpression) static Comparison
isLess
(Expression leftColumnOrExpression, Expression rightColumnOrExpression) static Comparison
isLessOrEqualTo
(Expression leftColumnOrExpression, Expression rightColumnOrExpression) static Comparison
isNotEqual
(Expression leftColumnOrExpression, Expression rightColumnOrExpression) Creates a!=
(not equals)Condition
.static IsNull
isNull
(Expression expression) Creates aIS NULL
condition.static Condition
Creates a plainsql
Condition
.static Like
like
(Expression leftColumnOrExpression, Expression rightColumnOrExpression) Creates aLIKE
Condition
.static Condition
Creates a nestedCondition
that is enclosed with parentheses.static Condition
Creates a NOTCondition
that reverses the condition.static Between
notBetween
(Expression columnOrExpression, Expression begin, Expression end) Creates aNOT BETWEEN
Condition
.static In
static Condition
notIn
(Expression columnOrExpression, Collection<? extends Expression> expressions) static In
notIn
(Expression columnOrExpression, Expression arg) Creates aNOT IN
clause
.static In
notIn
(Expression columnOrExpression, Expression... expressions) static Like
notLike
(Expression leftColumnOrExpression, Expression rightColumnOrExpression) Creates aNOT LIKE
Condition
.
-
Method Details
-
just
Creates a plainsql
Condition
.- Parameters:
sql
- the SQL, must not be null or empty.- Returns:
- a SQL
Expression
.
-
nest
Creates a nestedCondition
that is enclosed with parentheses. Useful to combineAND
andOR
statements.- Parameters:
condition
- the nested condition.- Returns:
- a
NestedCondition
. - Since:
- 2.0
-
not
Creates a NOTCondition
that reverses the condition.- Parameters:
condition
- the condition toNOT
.- Returns:
- a NOT
Condition
. - Since:
- 3.1.6
-
isNull
Creates aIS 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
Creates aBETWEEN
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
Creates aNOT 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) - 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) - 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) - 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) - Parameters:
leftColumnOrExpression
- left side of the comparison.rightColumnOrExpression
- right side of the comparison.- Returns:
- the
Comparison
condition.
-
like
Creates aLIKE
Condition
.- Parameters:
leftColumnOrExpression
- left side of the comparison.rightColumnOrExpression
- right side of the comparison.- Returns:
- the
Comparison
condition.
-
notLike
Creates aNOT LIKE
Condition
.- Parameters:
leftColumnOrExpression
- left side of the comparison.rightColumnOrExpression
- right side of the comparison.- Returns:
- the
Comparison
condition. - Since:
- 2.0
-
in
Creates aIN
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) - Parameters:
columnOrExpression
- left hand side of theCondition
must not be null.expressions
- right hand side (collectionExpression
) must not be null.- Returns:
- the
In
Condition
.
-
in
- Parameters:
columnOrExpression
- left hand side of theCondition
must not be null.expressions
- right hand side (collectionExpression
) must not be null.- Returns:
- the
In
Condition
.
-
in
- Parameters:
column
- the column to compare.subselect
- the subselect.- Returns:
- the
In
condition.
-
notIn
Creates aNOT 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) - Parameters:
columnOrExpression
- left hand side of theCondition
must not be null.expressions
- right hand side (collectionExpression
) must not be null.- Returns:
- the
In
Condition
.
-
notIn
- Parameters:
columnOrExpression
- left hand side of theCondition
must not be null.expressions
- right hand side (collectionExpression
) must not be null.- Returns:
- the
NOT IN
Condition
.
-
notIn
- Parameters:
column
- the column to compare.subselect
- the subselect.- Returns:
- the
NOT IN
condition.
-