Class JpaQueryCreator
java.lang.Object
org.springframework.data.repository.query.parser.AbstractQueryCreator<jakarta.persistence.criteria.CriteriaQuery<? extends Object>,jakarta.persistence.criteria.Predicate>
org.springframework.data.jpa.repository.query.JpaQueryCreator
- Direct Known Subclasses:
JpaCountQueryCreator
public class JpaQueryCreator
extends AbstractQueryCreator<jakarta.persistence.criteria.CriteriaQuery<? extends Object>,jakarta.persistence.criteria.Predicate>
Query creator to create a
CriteriaQuery
from a PartTree
.- Author:
- Oliver Gierke, Mark Paluch, Michael Cramer, Mark Paluch, Reda.Housni-Alaoui, Moritz Becker, Andrey Kovalev, Greg Turnquist
-
Constructor Summary
ConstructorDescriptionJpaQueryCreator
(PartTree tree, ReturnedType type, jakarta.persistence.criteria.CriteriaBuilder builder, org.springframework.data.jpa.repository.query.ParameterMetadataProvider provider) Create a newJpaQueryCreator
. -
Method Summary
Modifier and TypeMethodDescriptionprotected jakarta.persistence.criteria.Predicate
protected final jakarta.persistence.criteria.CriteriaQuery<? extends Object>
Finalizes the givenPredicate
and applies the given sort.protected jakarta.persistence.criteria.CriteriaQuery<? extends Object>
complete
(jakarta.persistence.criteria.Predicate predicate, Sort sort, jakarta.persistence.criteria.CriteriaQuery<? extends Object> query, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<?> root) Template method to finalize the givenPredicate
using the givenCriteriaQuery
andCriteriaBuilder
.protected jakarta.persistence.criteria.Predicate
protected jakarta.persistence.criteria.CriteriaQuery<? extends Object>
createCriteriaQuery
(jakarta.persistence.criteria.CriteriaBuilder builder, ReturnedType type) Creates theCriteriaQuery
to apply predicates on.List<org.springframework.data.jpa.repository.query.ParameterMetadataProvider.ParameterMetadata<?>>
Returns allParameterExpression
created when creating the query.protected jakarta.persistence.criteria.Predicate
or
(jakarta.persistence.criteria.Predicate base, jakarta.persistence.criteria.Predicate predicate) Methods inherited from class org.springframework.data.repository.query.parser.AbstractQueryCreator
createQuery, createQuery
-
Constructor Details
-
JpaQueryCreator
public JpaQueryCreator(PartTree tree, ReturnedType type, jakarta.persistence.criteria.CriteriaBuilder builder, org.springframework.data.jpa.repository.query.ParameterMetadataProvider provider) Create a newJpaQueryCreator
.- Parameters:
tree
- must not be null.type
- must not be null.builder
- must not be null.provider
- must not be null.
-
-
Method Details
-
createCriteriaQuery
protected jakarta.persistence.criteria.CriteriaQuery<? extends Object> createCriteriaQuery(jakarta.persistence.criteria.CriteriaBuilder builder, ReturnedType type) Creates theCriteriaQuery
to apply predicates on.- Parameters:
builder
- will never be null.type
- will never be null.- Returns:
- must not be null.
-
getParameterExpressions
public List<org.springframework.data.jpa.repository.query.ParameterMetadataProvider.ParameterMetadata<?>> getParameterExpressions()Returns allParameterExpression
created when creating the query.- Returns:
- the parameterExpressions
-
create
- Specified by:
create
in classAbstractQueryCreator<jakarta.persistence.criteria.CriteriaQuery<? extends Object>,
jakarta.persistence.criteria.Predicate>
-
and
protected jakarta.persistence.criteria.Predicate and(Part part, jakarta.persistence.criteria.Predicate base, Iterator<Object> iterator) - Specified by:
and
in classAbstractQueryCreator<jakarta.persistence.criteria.CriteriaQuery<? extends Object>,
jakarta.persistence.criteria.Predicate>
-
or
protected jakarta.persistence.criteria.Predicate or(jakarta.persistence.criteria.Predicate base, jakarta.persistence.criteria.Predicate predicate) - Specified by:
or
in classAbstractQueryCreator<jakarta.persistence.criteria.CriteriaQuery<? extends Object>,
jakarta.persistence.criteria.Predicate>
-
complete
protected final jakarta.persistence.criteria.CriteriaQuery<? extends Object> complete(jakarta.persistence.criteria.Predicate predicate, Sort sort) Finalizes the givenPredicate
and applies the given sort. Delegates tocomplete(Predicate, Sort, CriteriaQuery, CriteriaBuilder, Root)
and hands it the currentCriteriaQuery
andCriteriaBuilder
.- Specified by:
complete
in classAbstractQueryCreator<jakarta.persistence.criteria.CriteriaQuery<? extends Object>,
jakarta.persistence.criteria.Predicate>
-
complete
protected jakarta.persistence.criteria.CriteriaQuery<? extends Object> complete(@Nullable jakarta.persistence.criteria.Predicate predicate, Sort sort, jakarta.persistence.criteria.CriteriaQuery<? extends Object> query, jakarta.persistence.criteria.CriteriaBuilder builder, jakarta.persistence.criteria.Root<?> root) Template method to finalize the givenPredicate
using the givenCriteriaQuery
andCriteriaBuilder
.- Parameters:
predicate
-sort
-query
-builder
-- Returns:
-