Module org.jooq
Package org.jooq

Interface Condition

All Superinterfaces:
Field<Boolean>, FieldOrConstraint, FieldOrRow, FieldOrRowOrSelect, GroupField, Named, OrderField<Boolean>, QueryPart, SelectField<Boolean>, SelectFieldOrAsterisk, Serializable, TableElement, Typed<Boolean>
All Known Subinterfaces:
False, JSONExistsOnStep, LikeEscapeStep, Null, QOM.And, QOM.ArrayAllMatch<T>, QOM.ArrayAnyMatch<T>, QOM.ArrayNoneMatch<T>, QOM.ArrayOverlap<T>, QOM.Between<T>, QOM.CombinedCondition<R>, QOM.CompareCondition<T,R>, QOM.Contains<T>, QOM.ContainsIgnoreCase<T>, QOM.Deleting, QOM.EndsWith<T>, QOM.EndsWithIgnoreCase<T>, QOM.Eq<T>, QOM.EqQuantified<T>, QOM.Exists, QOM.False, QOM.FieldCondition, QOM.Ge<T>, QOM.GeQuantified<T>, QOM.Gt<T>, QOM.GtQuantified<T>, QOM.In<T>, QOM.InList<T>, QOM.Inserting, QOM.IsDistinctFrom<T>, QOM.IsDocument, QOM.IsJson, QOM.IsNotDistinctFrom<T>, QOM.IsNotDocument, QOM.IsNotJson, QOM.IsNotNull, QOM.IsNull, QOM.JSONBKeyExists, QOM.JSONKeyExists, QOM.Le<T>, QOM.LeQuantified<T>, QOM.Like, QOM.LikeIgnoreCase, QOM.LikeQuantified, QOM.Lt<T>, QOM.LtQuantified<T>, QOM.Ne<T>, QOM.NeQuantified<T>, QOM.Not, QOM.NotIn<T>, QOM.NotInList<T>, QOM.NotLike, QOM.NotLikeIgnoreCase, QOM.NotLikeQuantified, QOM.NotSimilarTo, QOM.NotSimilarToQuantified, QOM.Null, QOM.Or, QOM.RegexpLike, QOM.RowEq<T>, QOM.RowGe<T>, QOM.RowGt<T>, QOM.RowIsNotNull, QOM.RowIsNull, QOM.RowLe<T>, QOM.RowLt<T>, QOM.RowNe<T>, QOM.RowOverlaps, QOM.SelectIsNotNull, QOM.SelectIsNull, QOM.SimilarTo, QOM.SimilarToQuantified, QOM.StartsWith<T>, QOM.StartsWithIgnoreCase<T>, QOM.StContains<T>, QOM.StCoveredBy<T>, QOM.StCovers<T>, QOM.StCrosses, QOM.StDisjoint<T>, QOM.StEquals<T>, QOM.StIntersects<T>, QOM.StIsClosed, QOM.StIsEmpty, QOM.StIsRing, QOM.StIsSimple, QOM.StIsValid, QOM.StOverlaps<T>, QOM.StTouches<T>, QOM.StWithin<T>, QOM.TableEq<R>, QOM.TableNe<R>, QOM.True, QOM.Unique, QOM.Updating, QOM.XMLExists, QOM.Xor, True
All Known Implementing Classes:
CustomCondition

public interface Condition extends Field<Boolean>
A condition or predicate.

Conditions can be used in a variety of SQL clauses. They're mainly used in a Select statement's WHERE clause, but can also appear in (non-exhaustive list):

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 on Field, such as Field.eq(Field).

Author:
Lukas Eder
  • Method Details

    • and

      @NotNull @Support @NotNull Condition and(Field<Boolean> other)
      Combine this condition with another one using the Operator.AND operator.
      Parameters:
      other - The other condition
      Returns:
      The combined condition
    • and

      @NotNull @Support @PlainSQL @NotNull Condition and(SQL sql)
      Combine this condition with another one using the Operator.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:
    • and

      @NotNull @Support @PlainSQL @NotNull Condition and(String sql)
      Combine this condition with another one using the Operator.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:
    • and

      @NotNull @Support @PlainSQL @NotNull Condition and(String sql, Object... bindings)
      Combine this condition with another one using the Operator.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
      bindings - The bindings
      Returns:
      The combined condition
      See Also:
    • and

      @NotNull @Support @PlainSQL @NotNull Condition and(String sql, QueryPart... parts)
      Combine this condition with another one using the Operator.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 injected
      parts - The QueryPart objects that are rendered at the {numbered placeholder} locations
      Returns:
      The combined condition
      See Also:
    • andNot

      @NotNull @Support @NotNull Condition andNot(Condition other)
      Combine this condition with a negated other one using the Operator.AND operator.
      Parameters:
      other - The other condition
      Returns:
      The combined condition
    • andNot

      @NotNull @Support @NotNull Condition andNot(Field<Boolean> other)
      Combine this condition with a negated other one using the Operator.AND operator.
      Parameters:
      other - The other condition
      Returns:
      The combined condition
    • andExists

      @NotNull @Support @NotNull Condition andExists(Select<?> select)
      Combine this condition with an EXISTS clause using the Operator.AND operator.
      Parameters:
      select - The EXISTS's subquery
      Returns:
      The combined condition
    • andNotExists

      @NotNull @Support @NotNull Condition andNotExists(Select<?> select)
      Combine this condition with a NOT EXIST clause using the Operator.AND operator.
      Parameters:
      select - The EXISTS's subquery
      Returns:
      The combined condition
    • or

      @NotNull @Support @NotNull Condition or(Field<Boolean> other)
      Combine this condition with another one using the Operator.OR operator.
      Parameters:
      other - The other condition
      Returns:
      The combined condition
    • or

      @NotNull @Support @PlainSQL @NotNull Condition or(SQL sql)
      Combine this condition with another one using the Operator.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:
    • or

      @NotNull @Support @PlainSQL @NotNull Condition or(String sql)
      Combine this condition with another one using the Operator.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:
    • or

      @NotNull @Support @PlainSQL @NotNull Condition or(String sql, Object... bindings)
      Combine this condition with another one using the Operator.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
      bindings - The bindings
      Returns:
      The combined condition
      See Also:
    • or

      @NotNull @Support @PlainSQL @NotNull Condition or(String sql, QueryPart... parts)
      Combine this condition with another one using the Operator.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 injected
      parts - The QueryPart objects that are rendered at the {numbered placeholder} locations
      Returns:
      The combined condition
      See Also:
    • orNot

      @NotNull @Support @NotNull Condition orNot(Condition other)
      Combine this condition with a negated other one using the Operator.OR operator.
      Parameters:
      other - The other condition
      Returns:
      The combined condition
    • orNot

      @NotNull @Support @NotNull Condition orNot(Field<Boolean> other)
      Combine this condition with a negated other one using the Operator.OR operator.
      Parameters:
      other - The other condition
      Returns:
      The combined condition
    • orExists

      @NotNull @Support @NotNull Condition orExists(Select<?> select)
      Combine this condition with an EXISTS clause using the Operator.OR operator.
      Parameters:
      select - The EXISTS's subquery
      Returns:
      The combined condition
    • orNotExists

      @NotNull @Support @NotNull Condition orNotExists(Select<?> select)
      Combine this condition with a NOT EXIST clause using the Operator.OR operator.
      Parameters:
      select - The EXISTS's subquery
      Returns:
      The combined condition
    • xor

      @NotNull @Support @NotNull Condition xor(Field<Boolean> other)
      Combine this condition with another one using the Operator.XOR operator.
      Parameters:
      other - The other condition
      Returns:
      The combined condition
    • xor

      @NotNull @Support @PlainSQL @NotNull Condition xor(SQL sql)
      Combine this condition with another one using the Operator.XOR 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:
    • xor

      @NotNull @Support @PlainSQL @NotNull Condition xor(String sql)
      Combine this condition with another one using the Operator.XOR 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:
    • xor

      @NotNull @Support @PlainSQL @NotNull Condition xor(String sql, Object... bindings)
      Combine this condition with another one using the Operator.XOR 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
      bindings - The bindings
      Returns:
      The combined condition
      See Also:
    • xor

      @NotNull @Support @PlainSQL @NotNull Condition xor(String sql, QueryPart... parts)
      Combine this condition with another one using the Operator.XOR 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 injected
      parts - The QueryPart objects that are rendered at the {numbered placeholder} locations
      Returns:
      The combined condition
      See Also:
    • xorNot

      @NotNull @Support @NotNull Condition xorNot(Condition other)
      Combine this condition with a negated other one using the Operator.XOR operator.
      Parameters:
      other - The other condition
      Returns:
      The combined condition
    • xorNot

      @NotNull @Support @NotNull Condition xorNot(Field<Boolean> other)
      Combine this condition with a negated other one using the Operator.XOR operator.
      Parameters:
      other - The other condition
      Returns:
      The combined condition
    • xorExists

      @NotNull @Support @NotNull Condition xorExists(Select<?> select)
      Combine this condition with an EXISTS clause using the Operator.XOR operator.
      Parameters:
      select - The EXISTS's subquery
      Returns:
      The combined condition
    • xorNotExists

      @NotNull @Support @NotNull Condition xorNotExists(Select<?> select)
      Combine this condition with a NOT EXIST clause using the Operator.XOR operator.
      Parameters:
      select - The EXISTS's subquery
      Returns:
      The combined condition
    • and

      @NotNull @Support @NotNull Condition and(Condition arg2)
      The AND operator.
    • not

      @NotNull @Support @NotNull Condition not()
      The NOT operator.
    • or

      @NotNull @Support @NotNull Condition or(Condition arg2)
      The OR operator.
    • xor

      @NotNull @Support @NotNull Condition xor(Condition arg2)
      The XOR operator.