Class CriteriaQueryBuilder<T>
java.lang.Object
google.registry.persistence.transaction.CriteriaQueryBuilder<T>
An extension of
CriteriaQuery
that uses a Builder-style pattern when adding "WHERE"
and/or "ORDER BY" clauses.
CriteriaQuery
, as is, requires that all clauses must be passed in at once -- if one
calls "WHERE" multiple times, the later call overwrites the earlier call.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Functional interface that defines the 'where' operator, e.g. -
Method Summary
Modifier and TypeMethodDescriptionjakarta.persistence.criteria.CriteriaQuery
<T> build()
Builds and returns the query, applying all WHERE and ORDER BY clauses at once.static <T> CriteriaQueryBuilder
<T> create
(JpaTransactionManager jpaTm, Class<T> clazz) Creates a query builder for the given entity manager.static <T> CriteriaQueryBuilder
<T> Creates a query builder that will SELECT from the given class.static <T> CriteriaQueryBuilder
<Long> createCount
(JpaTransactionManager jpaTm, Class<T> clazz) Creates a "count" query for the table for the class.orderByAsc
(String fieldName) Orders the result by the given field ascending.orderByDesc
(String fieldName) Orders the result by the given field descending.<U> CriteriaQueryBuilder
<T> where
(String fieldName, CriteriaQueryBuilder.WhereOperator<U> whereClause, U value) Adds a WHERE clause to the query, given the specified operation, field, and value.whereFieldContains
(String fieldName, Object value) Adds a WHERE clause to the query specifying that a collection field must contain a particular value.whereFieldIsIn
(String fieldName, Collection<?> values) Adds a WHERE clause to the query specifying that a value must be in the given collection.whereFieldIsNotIn
(String fieldName, Collection<?> values) Adds a WHERE clause to the query specifying that a value must not be in the given collection.
-
Method Details
-
where
public <U> CriteriaQueryBuilder<T> where(String fieldName, CriteriaQueryBuilder.WhereOperator<U> whereClause, U value) Adds a WHERE clause to the query, given the specified operation, field, and value. -
whereFieldIsIn
Adds a WHERE clause to the query specifying that a value must be in the given collection. -
whereFieldIsNotIn
Adds a WHERE clause to the query specifying that a value must not be in the given collection. -
whereFieldContains
Adds a WHERE clause to the query specifying that a collection field must contain a particular value. -
orderByAsc
Orders the result by the given field ascending. -
orderByDesc
Orders the result by the given field descending. -
build
Builds and returns the query, applying all WHERE and ORDER BY clauses at once. -
create
Creates a query builder that will SELECT from the given class. -
create
Creates a query builder for the given entity manager. -
createCount
public static <T> CriteriaQueryBuilder<Long> createCount(JpaTransactionManager jpaTm, Class<T> clazz) Creates a "count" query for the table for the class.
-