-
- All Superinterfaces:
QueryPart
,Serializable
- All Known Subinterfaces:
False
,LikeEscapeStep
,True
- All Known Implementing Classes:
CustomCondition
public interface Condition extends QueryPart
A condition or predicate.Conditions can be used in a variety of SQL clauses. They're mainly used in a
Select
statement'sWHERE
clause, but can also appear in (non-exhaustive list):SELECT .. WHERE
, e.g. viaSelectWhereStep.where(Condition)
SELECT .. HAVING
, e.g. viaSelectHavingStep.having(Condition)
- In a
CASE
expression, e.g. viaDSL.case_()
andCase.when(Condition, Field)
- As an ordinary column expression, e.g. via
DSL.field(Condition)
- In filtered aggregate functions, e.g. via
AggregateFilterStep.filterWhere(Condition)
- ... and many more
Example:
// Assuming import static org.jooq.impl.DSL.*; using(configuration) .select() .from(ACTOR) .where(ACTOR.ACTOR_ID.eq(1)) // The eq operator produces a Condition from two Fields .fetch();
Instances can be created using
DSL.condition(Field)
and overloads, or by calling a comparison operator method onField
, such asField.eq(Field)
.- Author:
- Lukas Eder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description Condition
and(Boolean other)
Deprecated.- 3.8.0 - [#4763] - Useand(Condition)
(typically withDSL.trueCondition()
,DSL.falseCondition()
, orDSL.noCondition()
as the parameter) orand(Field)
instead.Condition
and(String sql)
Combine this condition with another one using theOperator.AND
operator.Condition
and(String sql, Object... bindings)
Combine this condition with another one using theOperator.AND
operator.Condition
and(String sql, QueryPart... parts)
Combine this condition with another one using theOperator.AND
operator.Condition
and(Condition other)
Combine this condition with another one using theOperator.AND
operator.Condition
and(Field<Boolean> other)
Combine this condition with another one using theOperator.AND
operator.Condition
and(SQL sql)
Combine this condition with another one using theOperator.AND
operator.Condition
andExists(Select<?> select)
Combine this condition with an EXISTS clause using theOperator.AND
operator.Condition
andNot(Boolean other)
Deprecated.- 3.8.0 - [#4763] - UseandNot(Condition)
(typically withDSL.trueCondition()
,DSL.falseCondition()
, orDSL.noCondition()
as the parameter) orandNot(Field)
instead.Condition
andNot(Condition other)
Combine this condition with a negated other one using theOperator.AND
operator.Condition
andNot(Field<Boolean> other)
Combine this condition with a negated other one using theOperator.AND
operator.Condition
andNotExists(Select<?> select)
Combine this condition with a NOT EXIST clause using theOperator.AND
operator.Condition
not()
Invert this conditionCondition
or(Boolean other)
Deprecated.- 3.8.0 - [#4763] - Useor(Condition)
(typically withDSL.trueCondition()
,DSL.falseCondition()
, orDSL.noCondition()
as the parameter) oror(Field)
instead.Condition
or(String sql)
Combine this condition with another one using theOperator.OR
operator.Condition
or(String sql, Object... bindings)
Combine this condition with another one using theOperator.OR
operator.Condition
or(String sql, QueryPart... parts)
Combine this condition with another one using theOperator.OR
operator.Condition
or(Condition other)
Combine this condition with another one using theOperator.OR
operator.Condition
or(Field<Boolean> other)
Combine this condition with another one using theOperator.OR
operator.Condition
or(SQL sql)
Combine this condition with another one using theOperator.OR
operator.Condition
orExists(Select<?> select)
Combine this condition with an EXISTS clause using theOperator.OR
operator.Condition
orNot(Boolean other)
Deprecated.- 3.8.0 - [#4763] - UseorNot(Condition)
(typically withDSL.trueCondition()
,DSL.falseCondition()
, orDSL.noCondition()
as the parameter) ororNot(Boolean)
instead.Condition
orNot(Condition other)
Combine this condition with a negated other one using theOperator.OR
operator.Condition
orNot(Field<Boolean> other)
Combine this condition with a negated other one using theOperator.OR
operator.Condition
orNotExists(Select<?> select)
Combine this condition with a NOT EXIST clause using theOperator.OR
operator.
-
-
-
Method Detail
-
and
@Support Condition and(Condition other)
Combine this condition with another one using theOperator.AND
operator.- Parameters:
other
- The other condition- Returns:
- The combined condition
-
and
@Support Condition and(Field<Boolean> other)
Combine this condition with another one using theOperator.AND
operator.- Parameters:
other
- The other condition- Returns:
- The combined condition
-
and
@Deprecated @Support Condition and(Boolean other)
Deprecated.- 3.8.0 - [#4763] - Useand(Condition)
(typically withDSL.trueCondition()
,DSL.falseCondition()
, orDSL.noCondition()
as the parameter) orand(Field)
instead. Due to ambiguity between calling this method usingField.equals(Object)
argument, vs. calling the other method via aField.equal(Object)
argument, this method will be removed in the future.Combine this condition with another one using theOperator.AND
operator.- Parameters:
other
- The other condition- Returns:
- The combined condition
-
and
@Support @PlainSQL Condition and(SQL sql)
Combine this condition with another one using theOperator.AND
operator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql
- The other condition- Returns:
- The combined condition
- See Also:
DSL.condition(SQL)
,SQL
-
and
@Support @PlainSQL Condition and(String sql)
Combine this condition with another one using theOperator.AND
operator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql
- The other condition- Returns:
- The combined condition
- See Also:
DSL.condition(String)
,SQL
-
and
@Support @PlainSQL Condition and(String sql, Object... bindings)
Combine this condition with another one using theOperator.AND
operator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql
- The other conditionbindings
- The bindings- Returns:
- The combined condition
- See Also:
DSL.condition(String, Object...)
,DSL.sql(String, Object...)
,SQL
-
and
@Support @PlainSQL Condition and(String sql, QueryPart... parts)
Combine this condition with another one using theOperator.AND
operator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql
- The SQL clause, containing {numbered placeholders} where query parts can be injectedparts
- TheQueryPart
objects that are rendered at the {numbered placeholder} locations- Returns:
- The combined condition
- See Also:
DSL.condition(String, QueryPart...)
,DSL.sql(String, QueryPart...)
,SQL
-
andNot
@Support Condition andNot(Condition other)
Combine this condition with a negated other one using theOperator.AND
operator.- Parameters:
other
- The other condition- Returns:
- The combined condition
-
andNot
@Support Condition andNot(Field<Boolean> other)
Combine this condition with a negated other one using theOperator.AND
operator.- Parameters:
other
- The other condition- Returns:
- The combined condition
-
andNot
@Deprecated @Support Condition andNot(Boolean other)
Deprecated.- 3.8.0 - [#4763] - UseandNot(Condition)
(typically withDSL.trueCondition()
,DSL.falseCondition()
, orDSL.noCondition()
as the parameter) orandNot(Field)
instead. Due to ambiguity between calling this method usingField.equals(Object)
argument, vs. calling the other method via aField.equal(Object)
argument, this method will be removed in the future.Combine this condition with a negated other one using theOperator.AND
operator.- Parameters:
other
- The other condition- Returns:
- The combined condition
-
andExists
@Support Condition andExists(Select<?> select)
Combine this condition with an EXISTS clause using theOperator.AND
operator.- Parameters:
select
- The EXISTS's subquery- Returns:
- The combined condition
-
andNotExists
@Support Condition andNotExists(Select<?> select)
Combine this condition with a NOT EXIST clause using theOperator.AND
operator.- Parameters:
select
- The EXISTS's subquery- Returns:
- The combined condition
-
or
@Support Condition or(Condition other)
Combine this condition with another one using theOperator.OR
operator.- Parameters:
other
- The other condition- Returns:
- The combined condition
-
or
@Support Condition or(Field<Boolean> other)
Combine this condition with another one using theOperator.OR
operator.- Parameters:
other
- The other condition- Returns:
- The combined condition
-
or
@Deprecated @Support Condition or(Boolean other)
Deprecated.- 3.8.0 - [#4763] - Useor(Condition)
(typically withDSL.trueCondition()
,DSL.falseCondition()
, orDSL.noCondition()
as the parameter) oror(Field)
instead. Due to ambiguity between calling this method usingField.equals(Object)
argument, vs. calling the other method via aField.equal(Object)
argument, this method will be removed in the future.Combine this condition with another one using theOperator.OR
operator.- Parameters:
other
- The other condition- Returns:
- The combined condition
-
or
@Support @PlainSQL Condition or(SQL sql)
Combine this condition with another one using theOperator.OR
operator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql
- The other condition- Returns:
- The combined condition
- See Also:
DSL.condition(SQL)
,SQL
-
or
@Support @PlainSQL Condition or(String sql)
Combine this condition with another one using theOperator.OR
operator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql
- The other condition- Returns:
- The combined condition
- See Also:
DSL.condition(String)
,SQL
-
or
@Support @PlainSQL Condition or(String sql, Object... bindings)
Combine this condition with another one using theOperator.OR
operator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql
- The other conditionbindings
- The bindings- Returns:
- The combined condition
- See Also:
DSL.condition(String, Object...)
,DSL.sql(String, Object...)
,SQL
-
or
@Support @PlainSQL Condition or(String sql, QueryPart... parts)
Combine this condition with another one using theOperator.OR
operator.NOTE: When inserting plain SQL into jOOQ objects, you must guarantee syntax integrity. You may also create the possibility of malicious SQL injection. Be sure to properly use bind variables and/or escape literals when concatenated into SQL clauses!
- Parameters:
sql
- The SQL clause, containing {numbered placeholders} where query parts can be injectedparts
- TheQueryPart
objects that are rendered at the {numbered placeholder} locations- Returns:
- The combined condition
- See Also:
DSL.condition(String, Object...)
,DSL.sql(String, QueryPart...)
,SQL
-
orNot
@Support Condition orNot(Condition other)
Combine this condition with a negated other one using theOperator.OR
operator.- Parameters:
other
- The other condition- Returns:
- The combined condition
-
orNot
@Support Condition orNot(Field<Boolean> other)
Combine this condition with a negated other one using theOperator.OR
operator.- Parameters:
other
- The other condition- Returns:
- The combined condition
-
orNot
@Deprecated @Support Condition orNot(Boolean other)
Deprecated.- 3.8.0 - [#4763] - UseorNot(Condition)
(typically withDSL.trueCondition()
,DSL.falseCondition()
, orDSL.noCondition()
as the parameter) ororNot(Boolean)
instead. Due to ambiguity between calling this method usingField.equals(Object)
argument, vs. calling the other method via aField.equal(Object)
argument, this method will be removed in the future.Combine this condition with a negated other one using theOperator.OR
operator.- Parameters:
other
- The other condition- Returns:
- The combined condition
-
orExists
@Support Condition orExists(Select<?> select)
Combine this condition with an EXISTS clause using theOperator.OR
operator.- Parameters:
select
- The EXISTS's subquery- Returns:
- The combined condition
-
orNotExists
@Support Condition orNotExists(Select<?> select)
Combine this condition with a NOT EXIST clause using theOperator.OR
operator.- Parameters:
select
- The EXISTS's subquery- Returns:
- The combined condition
-
not
@Support Condition not()
Invert this conditionThis is the same as calling
DSL.not(Condition)
- Returns:
- This condition, inverted
-
-