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:
WhereBuilderrefers to one or more preview APIs:StringTemplate.
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract QueryBuilder.PredicateBuilder<T, R, ID> exists(QueryBuilder<?, ?, ?> subquery) Adds anEXISTScondition to the WHERE clause using the specified subquery.final QueryBuilder.PredicateBuilder<T, R, ID> FALSE()A predicate that always evaluates to false.abstract QueryBuilder.PredicateBuilder<T, R, ID> notExists(QueryBuilder<?, ?, ?> subquery) Adds anNOT EXISTScondition to the WHERE clause using the specified subquery.final QueryBuilder.PredicateBuilder<T, R, ID> TRUE()A predicate that always evaluates to true.abstract QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified records.abstract QueryBuilder.PredicateBuilder<T, R, ID> where(StringTemplatePREVIEW template) Appends a custom expression to the WHERE clause.final <V extends Record>
QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified records.abstract <V extends Record>
QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified ref.abstract <V> QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified objects at the specified path in the table graph.final <V> QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified objects at the specified path in the table graph.final <V extends Record>
QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified record.abstract QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified record.abstract QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified records.abstract QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified record.final <V extends Record>
QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified records.abstract <V extends Record>
QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified ref.abstract <V> QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified objects at the specified path in the table graph or manually added joins.final <V> QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified objects at the specified path in the table graph or manually added joins.final <V extends Record>
QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified record.abstract QueryBuilder.PredicateBuilder<T, R, ID> whereAnyRef(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.abstract QueryBuilder.PredicateBuilder<T, R, ID> whereAnyRef(Ref<? extends Record> ref) Adds a condition to the WHERE clause that matches the specified primary key of the table, expressed by a ref.abstract <V extends Record>
QueryBuilder.PredicateBuilder<T, R, ID> whereAnyRef(Metamodel<?, V> path, Iterable<? extends Ref<V>> it) Adds a condition to the WHERE clause that matches the specified refs.abstract QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified primary key of the table.abstract QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified primary keys of the table.protected abstract <V> QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified objects at the specified path in the table graph or manually added joins.abstract QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified primary keys of the table, expressed by a ref.abstract QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified primary key of the table, expressed by a ref.abstract <V extends Record>
QueryBuilder.PredicateBuilder<T, R, ID> Adds a condition to the WHERE clause that matches the specified refs.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface st.orm.template.SubqueryTemplate
subquery, subquery, subquery
-
Constructor Details
-
WhereBuilder
public WhereBuilder()
-
-
Method Details
-
TRUE
A predicate that always evaluates to true. -
FALSE
A predicate that always evaluates to false. -
exists
Adds anEXISTScondition to the WHERE clause using the specified subquery.This method appends an
EXISTSclause 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.PredicateBuilderwith the EXISTS condition applied.
-
notExists
public abstract QueryBuilder.PredicateBuilder<T,R, notExistsID> (@Nonnull QueryBuilder<?, ?, ?> subquery) Adds anNOT EXISTScondition to the WHERE clause using the specified subquery.This method appends an
NOT EXISTSclause 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.PredicateBuilderwith the NOT EXISTS condition applied.
-
whereId
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
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, whereAnyRefID> (@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
Adds a condition to the WHERE clause that matches the specified record.- Parameters:
record- the record to match.- Returns:
- the predicate builder.
-
whereAny
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
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, whereRefID> (@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, whereAnyRefID> (@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
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, whereAnyID> (@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, whereID> (@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, whereAnyID> (@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, whereID> (@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, whereAnyID> (@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, whereRefID> (@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, whereAnyRefID> (@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, whereID> (@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, whereAnyID> (@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, whereID> (@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, whereAnyID> (@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, whereID> (@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, whereAnyID> (@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, whereID> (@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, whereImplID> (@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
-
WhereBuilderwhen preview features are enabled.