Class AbstractJpaQuery

java.lang.Object
org.springframework.data.jpa.repository.query.AbstractJpaQuery
All Implemented Interfaces:
RepositoryQuery
Direct Known Subclasses:
PartTreeJpaQuery

public abstract class AbstractJpaQuery extends Object implements RepositoryQuery
Abstract base class to implement RepositoryQuerys.
Author:
Oliver Gierke, Thomas Darimont, Mark Paluch, Christoph Strobl, Nicolas Cirigliano, Jens Schauder, Сергей Цыпанов, Wonchul Heo, Julia Lee
  • Constructor Details

  • Method Details

    • getQueryMethod

      public JpaQueryMethod getQueryMethod()
      Specified by:
      getQueryMethod in interface RepositoryQuery
    • getEntityManager

      protected jakarta.persistence.EntityManager getEntityManager()
      Returns the EntityManager.
      Returns:
      will never be null.
    • getMetamodel

      protected JpaMetamodel getMetamodel()
      Returns the JpaMetamodel.
      Returns:
    • execute

      @Nullable public Object execute(Object[] parameters)
      Specified by:
      execute in interface RepositoryQuery
    • getExecution

      protected JpaQueryExecution getExecution()
    • applyHints

      protected <T extends jakarta.persistence.Query> T applyHints(T query, JpaQueryMethod method)
      Applies the declared query hints to the given query.
      Parameters:
      query -
      Returns:
    • applyQueryHint

      protected <T extends jakarta.persistence.Query> void applyQueryHint(T query, jakarta.persistence.QueryHint hint)
      Protected to be able to customize in sub-classes.
      Parameters:
      query - must not be null.
      hint - must not be null.
    • createBinder

      protected ParameterBinder createBinder()
    • createQuery

      protected jakarta.persistence.Query createQuery(JpaParametersParameterAccessor parameters)
    • createCountQuery

      protected jakarta.persistence.Query createCountQuery(JpaParametersParameterAccessor values)
    • getTypeToRead

      @Nullable protected Class<?> getTypeToRead(ReturnedType returnedType)
      Returns the type to be used when creating the JPA query.
      Returns:
      Since:
      2.0.5
    • doCreateQuery

      protected abstract jakarta.persistence.Query doCreateQuery(JpaParametersParameterAccessor accessor)
      Creates a Query instance for the given values.
      Parameters:
      accessor - must not be null.
      Returns:
    • doCreateCountQuery

      protected abstract jakarta.persistence.Query doCreateCountQuery(JpaParametersParameterAccessor accessor)
      Creates a TypedQuery for counting using the given values.
      Parameters:
      accessor - must not be null.
      Returns: