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

    Constructors
    Constructor
    Description
    JpaQueryCreator(PartTree tree, ReturnedType type, jakarta.persistence.criteria.CriteriaBuilder builder, org.springframework.data.jpa.repository.query.ParameterMetadataProvider provider)
    Create a new JpaQueryCreator.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected jakarta.persistence.criteria.Predicate
    and(Part part, jakarta.persistence.criteria.Predicate base, Iterator<Object> iterator)
     
    protected final jakarta.persistence.criteria.CriteriaQuery<? extends Object>
    complete(jakarta.persistence.criteria.Predicate predicate, Sort sort)
    Finalizes the given Predicate 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 given Predicate using the given CriteriaQuery and CriteriaBuilder.
    protected jakarta.persistence.criteria.Predicate
    create(Part part, Iterator<Object> iterator)
     
    protected jakarta.persistence.criteria.CriteriaQuery<? extends Object>
    createCriteriaQuery(jakarta.persistence.criteria.CriteriaBuilder builder, ReturnedType type)
    Creates the CriteriaQuery to apply predicates on.
    List<org.springframework.data.jpa.repository.query.ParameterMetadataProvider.ParameterMetadata<?>>
    Returns all ParameterExpression 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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JpaQueryCreator

      public JpaQueryCreator(PartTree tree, ReturnedType type, jakarta.persistence.criteria.CriteriaBuilder builder, org.springframework.data.jpa.repository.query.ParameterMetadataProvider provider)
      Create a new JpaQueryCreator.
      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 the CriteriaQuery 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 all ParameterExpression created when creating the query.
      Returns:
      the parameterExpressions
    • create

      protected jakarta.persistence.criteria.Predicate create(Part part, Iterator<Object> iterator)
      Specified by:
      create in class AbstractQueryCreator<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 class AbstractQueryCreator<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 class AbstractQueryCreator<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 given Predicate and applies the given sort. Delegates to complete(Predicate, Sort, CriteriaQuery, CriteriaBuilder, Root) and hands it the current CriteriaQuery and CriteriaBuilder.
      Specified by:
      complete in class AbstractQueryCreator<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 given Predicate using the given CriteriaQuery and CriteriaBuilder.
      Parameters:
      predicate -
      sort -
      query -
      builder -
      Returns: