Interface PredicateBuilder.SubqueryFactory
- Enclosing interface:
PredicateBuilder
public static interface PredicateBuilder.SubqueryFactory
This interface allows to create subqueries in predicates without exposing the
CriteriaQuery
instance.-
Method Summary
Modifier and TypeMethodDescription<T> SubqueryBuilder
<T> createSubquery
(Class<T> resultType, jakarta.persistence.criteria.From<?, ?> root, String relationName) <T> SubqueryBuilder
<T> createSubquery
(Class<T> type, String relationName, String column) Create a correlated sub query that selects a column from the related entity model, applying the given relation path to the current query root.<T> SubqueryBuilder
<T> createSubquery
(Class<T> type, String relationName, BiFunction<jakarta.persistence.criteria.CriteriaBuilder, jakarta.persistence.criteria.From<?, ?>, jakarta.persistence.criteria.Expression<T>> selectionFunc) Create a correlated sub query that selects the expression returned by the given selectionFunc from the related entity model, applying the given relation path to the current query root.<T> SubqueryBuilder
<T> createUncorrelatedSubquery
(Class<T> resultType, Class<?> targetType) <T> SubqueryBuilder
<T> createUncorrelatedSubquery
(Class<T> type, String entityModel, String column) Create an uncorrelated sub query that selects any column from any given entity model without a relation.<T> SubqueryBuilder
<T> createUncorrelatedSubquery
(Class<T> type, String entityModel, BiFunction<jakarta.persistence.criteria.CriteriaBuilder, jakarta.persistence.criteria.From<?, ?>, jakarta.persistence.criteria.Expression<T>> selectionFunc) Create an uncorrelated sub query that selects the expression returned by the given selectionFunc from any given entity model without a relation.deriveFor
(jakarta.persistence.criteria.From<?, ?> root)
-
Method Details
-
deriveFor
-
createSubquery
<T> SubqueryBuilder<T> createSubquery(Class<T> resultType, jakarta.persistence.criteria.From<?, ?> root, String relationName) -
createSubquery
Create a correlated sub query that selects a column from the related entity model, applying the given relation path to the current query root.- Type Parameters:
T
- the return type of the Query, equal to the type of the column- Parameters:
type
- the type of the selected columnrelationName
- the name to resolve to the target entity modelcolumn
- the single column to select- Returns:
- the created
SubqueryBuilder
-
createSubquery
<T> SubqueryBuilder<T> createSubquery(Class<T> type, String relationName, BiFunction<jakarta.persistence.criteria.CriteriaBuilder, jakarta.persistence.criteria.From<?, ?>, jakarta.persistence.criteria.Expression<T>> selectionFunc) Create a correlated sub query that selects the expression returned by the given selectionFunc from the related entity model, applying the given relation path to the current query root.- Type Parameters:
T
- the return type of the Query, equal to the type of the column- Parameters:
type
- the type of the selected columnrelationName
- the name to resolve to the target entity modelselectionFunc
- function returning the expression to select- Returns:
- the created
SubqueryBuilder
-