Module storm

Class QueryBuilder.WhereBuilder<T extends Record,R,ID>

java.lang.Object
st.orm.template.QueryBuilder.WhereBuilder<T,R,ID>
Type Parameters:
T - the type of the table being queried.
R - the type of the result.
ID - the type of the primary key.
All Implemented Interfaces:
SubqueryTemplate
Enclosing class:
QueryBuilder<T extends Record,R,ID>

public abstract static class QueryBuilder.WhereBuilder<T extends Record,R,ID> extends Object implements SubqueryTemplate
WhereBuilder relies on preview features of the Java platform:
Programs can only use WhereBuilder when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A builder for constructing the WHERE clause of the query.
  • Constructor Details

    • WhereBuilder

      public WhereBuilder()
  • Method Details

    • TRUE

      public final QueryBuilder.PredicateBuilder<T,R,ID> TRUE()
      A predicate that always evaluates to true.
    • FALSE

      public final QueryBuilder.PredicateBuilder<T,R,ID> FALSE()
      A predicate that always evaluates to false.
    • exists

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> exists(@Nonnull QueryBuilder<?,?,?> subquery)
      Adds an EXISTS condition to the WHERE clause using the specified subquery.

      This method appends an EXISTS clause to the current query's WHERE condition. It checks whether the provided subquery returns any rows, allowing you to filter results based on the existence of related data. This is particularly useful for constructing queries that need to verify the presence of certain records in a related table or subquery.

      Parameters:
      subquery - the subquery to check for existence.
      Returns:
      the updated QueryBuilder.PredicateBuilder with the EXISTS condition applied.
    • notExists

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> notExists(@Nonnull QueryBuilder<?,?,?> subquery)
      Adds an NOT EXISTS condition to the WHERE clause using the specified subquery.

      This method appends an NOT EXISTS clause to the current query's WHERE condition. It checks whether the provided subquery returns any rows, allowing you to filter results based on the existence of related data. This is particularly useful for constructing queries that need to verify the absence of certain records in a related table or subquery.

      Parameters:
      subquery - the subquery to check for existence.
      Returns:
      the updated QueryBuilder.PredicateBuilder with the NOT EXISTS condition applied.
    • whereId

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> whereId(@Nonnull ID id)
      Adds a condition to the WHERE clause that matches the specified primary key of the table.
      Parameters:
      id - the id to match.
      Returns:
      the predicate builder.
    • whereRef

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> whereRef(@Nonnull Ref<T> ref)
      Adds a condition to the WHERE clause that matches the specified primary key of the table, expressed by a ref.
      Parameters:
      ref - the ref to match.
      Returns:
      the predicate builder.
      Since:
      1.3
    • whereAnyRef

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> whereAnyRef(@Nonnull Ref<? extends Record> ref)
      Adds a condition to the WHERE clause that matches the specified primary key of the table, expressed by a ref. The ref can represent any of the related tables in the table graph or manually added joins.
      Parameters:
      ref - the ref to match.
      Returns:
      the predicate builder.
      Since:
      1.3
    • where

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> where(@Nonnull T record)
      Adds a condition to the WHERE clause that matches the specified record.
      Parameters:
      record - the record to match.
      Returns:
      the predicate builder.
    • whereAny

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> whereAny(@Nonnull Record record)
      Adds a condition to the WHERE clause that matches the specified record. The record can represent any of the related tables in the table graph or manually added joins.
      Parameters:
      record - the record to match.
      Returns:
      the predicate builder.
      Since:
      1.2
    • whereId

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> whereId(@Nonnull Iterable<? extends ID> it)
      Adds a condition to the WHERE clause that matches the specified primary keys of the table.
      Parameters:
      it - the ids to match.
      Returns:
      the predicate builder.
      Since:
      1.2
    • whereRef

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> whereRef(@Nonnull Iterable<? extends Ref<T>> it)
      Adds a condition to the WHERE clause that matches the specified primary keys of the table, expressed by a ref.
      Parameters:
      it - the refs to match.
      Returns:
      the predicate builder.
      Since:
      1.3
    • whereAnyRef

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> whereAnyRef(@Nonnull Iterable<? extends Ref<? extends Record>> it)
      Adds a condition to the WHERE clause that matches the specified primary keys of the table, expressed by a ref. The ref can represent any of the related tables in the table graph or manually added joins.
      Parameters:
      it - the refs to match.
      Returns:
      the predicate builder.
      Since:
      1.3
    • where

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> where(@Nonnull Iterable<? extends T> it)
      Adds a condition to the WHERE clause that matches the specified records.
      Parameters:
      it - the records to match.
      Returns:
      the predicate builder.
    • whereAny

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> whereAny(@Nonnull Iterable<? extends Record> it)
      Adds a condition to the WHERE clause that matches the specified records. The record can represent any of the related tables in the table graph or manually added joins.
      Parameters:
      it - the records to match.
      Returns:
      the query builder.
    • where

      public final <V extends Record> QueryBuilder.PredicateBuilder<T,R,ID> where(@Nonnull Metamodel<T,V> path, @Nonnull V record)
      Adds a condition to the WHERE clause that matches the specified record. The record can represent any of the related tables in the table graph.
      Parameters:
      path - the path to the object in the table graph.
      record - the records to match.
      Returns:
      the predicate builder.
    • whereAny

      public final <V extends Record> QueryBuilder.PredicateBuilder<T,R,ID> whereAny(@Nonnull Metamodel<?,V> path, @Nonnull V record)
      Adds a condition to the WHERE clause that matches the specified record. The record can represent any of the related tables in the table graph or manually added joins.
      Parameters:
      record - the records to match.
      Returns:
      the predicate builder.
    • where

      public abstract <V extends Record> QueryBuilder.PredicateBuilder<T,R,ID> where(@Nonnull Metamodel<T,V> path, @Nonnull Ref<V> ref)
      Adds a condition to the WHERE clause that matches the specified ref. The record can represent any of the related tables in the table graph.
      Parameters:
      path - the path to the object in the table graph.
      ref - the ref to match.
      Returns:
      the predicate builder.
      Since:
      1.3
    • whereAny

      public abstract <V extends Record> QueryBuilder.PredicateBuilder<T,R,ID> whereAny(@Nonnull Metamodel<?,V> path, @Nonnull Ref<V> ref)
      Adds a condition to the WHERE clause that matches the specified ref. The record can represent any of the related tables in the table graph or manually added joins.
      Parameters:
      path - the path to the object in the table graph.
      ref - the ref to match.
      Returns:
      the predicate builder.
      Since:
      1.3
    • whereRef

      public abstract <V extends Record> QueryBuilder.PredicateBuilder<T,R,ID> whereRef(@Nonnull Metamodel<T,V> path, @Nonnull Iterable<? extends Ref<V>> it)
      Adds a condition to the WHERE clause that matches the specified refs. The refs can represent any of the related tables in the table graph.
      Parameters:
      path - the path to the ref in the table graph.
      it - the refs to match.
      Returns:
      the predicate builder.
      Since:
      1.3
    • whereAnyRef

      public abstract <V extends Record> QueryBuilder.PredicateBuilder<T,R,ID> whereAnyRef(@Nonnull Metamodel<?,V> path, @Nonnull Iterable<? extends Ref<V>> it)
      Adds a condition to the WHERE clause that matches the specified refs. The refs can represent any of the related tables in the table graph.
      Parameters:
      path - the path to the ref in the table graph.
      it - the refs to match.
      Returns:
      the predicate builder.
      Since:
      1.3
    • where

      public final <V extends Record> QueryBuilder.PredicateBuilder<T,R,ID> where(@Nonnull Metamodel<T,V> path, @Nonnull Iterable<V> it)
      Adds a condition to the WHERE clause that matches the specified records. The records can represent any of the related tables in the table graph.
      Parameters:
      path - the path to the object in the table graph.
      it - the records to match.
      Returns:
      the predicate builder.
    • whereAny

      public final <V extends Record> QueryBuilder.PredicateBuilder<T,R,ID> whereAny(@Nonnull Metamodel<?,V> path, @Nonnull Iterable<V> it)
      Adds a condition to the WHERE clause that matches the specified records. The records can represent any of the related tables in the table graph or manually added joins.
      Parameters:
      path - the path to the object in the table graph.
      it - the records to match.
      Returns:
      the predicate builder.
    • where

      public abstract <V> QueryBuilder.PredicateBuilder<T,R,ID> where(@Nonnull Metamodel<T,V> path, @Nonnull Operator operator, @Nonnull Iterable<? extends V> it)
      Adds a condition to the WHERE clause that matches the specified objects at the specified path in the table graph.
      Type Parameters:
      V - the type of the object that the metamodel represents.
      Parameters:
      path - the path to the object in the table graph.
      operator - the operator to use for the comparison.
      it - the objects to match, which can be primary keys, records representing the table, or fields in the table graph.
      Returns:
      the query builder.
      Since:
      1.2
    • whereAny

      public abstract <V> QueryBuilder.PredicateBuilder<T,R,ID> whereAny(@Nonnull Metamodel<?,V> path, @Nonnull Operator operator, @Nonnull Iterable<? extends V> it)
      Adds a condition to the WHERE clause that matches the specified objects at the specified path in the table graph or manually added joins.
      Type Parameters:
      V - the type of the object that the metamodel represents.
      Parameters:
      path - the path to the object in the table graph.
      operator - the operator to use for the comparison.
      it - the objects to match, which can be primary keys, records representing the table, or fields in the table graph.
      Returns:
      the query builder.
      Since:
      1.2
    • where

      @SafeVarargs public final <V> QueryBuilder.PredicateBuilder<T,R,ID> where(@Nonnull Metamodel<T,V> path, @Nonnull Operator operator, @Nonnull V... o)
      Adds a condition to the WHERE clause that matches the specified objects at the specified path in the table graph.
      Type Parameters:
      V - the type of the object that the metamodel represents.
      Parameters:
      path - the path to the object in the table graph.
      operator - the operator to use for the comparison.
      o - the object(s) to match, which can be primary keys, records representing the table, or fields in the table graph.
      Returns:
      the query builder.
      Since:
      1.2
    • whereAny

      @SafeVarargs public final <V> QueryBuilder.PredicateBuilder<T,R,ID> whereAny(@Nonnull Metamodel<?,V> path, @Nonnull Operator operator, @Nonnull V... o)
      Adds a condition to the WHERE clause that matches the specified objects at the specified path in the table graph or manually added joins.
      Type Parameters:
      V - the type of the object that the metamodel represents.
      Parameters:
      path - the path to the object in the table graph.
      operator - the operator to use for the comparison.
      o - the object(s) to match, which can be primary keys, records representing the table, or fields in the table graph.
      Returns:
      the query builder.
      Since:
      1.2
    • where

      public abstract QueryBuilder.PredicateBuilder<T,R,ID> where(@Nonnull StringTemplatePREVIEW template)
      Appends a custom expression to the WHERE clause.
      Parameters:
      template - the expression to add.
      Returns:
      the predicate builder.
    • whereImpl

      protected abstract <V> QueryBuilder.PredicateBuilder<T,R,ID> whereImpl(@Nonnull Metamodel<?,V> path, @Nonnull Operator operator, @Nonnull V[] o)
      Adds a condition to the WHERE clause that matches the specified objects at the specified path in the table graph or manually added joins.
      Type Parameters:
      V - the type of the object that the metamodel represents.
      Parameters:
      path - the path to the object in the table graph.
      operator - the operator to use for the comparison.
      o - the object(s) to match, which can be primary keys, records representing the table, or fields in the table graph.
      Returns:
      the query builder.
      Since:
      1.2