Class AbstractJpaQuery
java.lang.Object
org.springframework.data.jpa.repository.query.AbstractJpaQuery
- All Implemented Interfaces:
org.springframework.data.repository.query.RepositoryQuery
- Direct Known Subclasses:
PartTreeJpaQuery
public abstract class AbstractJpaQuery
extends Object
implements org.springframework.data.repository.query.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 Summary
ConstructorsConstructorDescriptionAbstractJpaQuery(JpaQueryMethod method, jakarta.persistence.EntityManager em) Creates a newAbstractJpaQueryfrom the givenJpaQueryMethod. -
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends jakarta.persistence.Query>
TapplyHints(T query, JpaQueryMethod method) Applies the declared query hints to the given query.protected <T extends jakarta.persistence.Query>
voidapplyQueryHint(T query, jakarta.persistence.QueryHint hint) Protected to be able to customize in sub-classes.protected ParameterBinderprotected jakarta.persistence.Queryprotected jakarta.persistence.QuerycreateQuery(JpaParametersParameterAccessor parameters) protected abstract jakarta.persistence.QueryCreates aTypedQueryfor counting using the given values.protected abstract jakarta.persistence.QuerydoCreateQuery(JpaParametersParameterAccessor accessor) Creates aQueryinstance for the given values.protected jakarta.persistence.EntityManagerReturns theEntityManager.protected JpaQueryExecutionprotected JpaMetamodelReturns theJpaMetamodel.protected Class<?>getTypeToRead(org.springframework.data.repository.query.ReturnedType returnedType) Returns the type to be used when creating the JPA query.
-
Constructor Details
-
AbstractJpaQuery
Creates a newAbstractJpaQueryfrom the givenJpaQueryMethod.- Parameters:
method-em-
-
-
Method Details
-
getQueryMethod
- Specified by:
getQueryMethodin interfaceorg.springframework.data.repository.query.RepositoryQuery
-
getEntityManager
protected jakarta.persistence.EntityManager getEntityManager()Returns theEntityManager.- Returns:
- will never be null.
-
getMetamodel
Returns theJpaMetamodel.- Returns:
-
execute
- Specified by:
executein interfaceorg.springframework.data.repository.query.RepositoryQuery
-
getExecution
-
applyHints
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
-
createQuery
-
createCountQuery
-
getTypeToRead
@Nullable protected Class<?> getTypeToRead(org.springframework.data.repository.query.ReturnedType returnedType) Returns the type to be used when creating the JPA query.- Returns:
- Since:
- 2.0.5
-
doCreateQuery
Creates aQueryinstance for the given values.- Parameters:
accessor- must not be null.- Returns:
-
doCreateCountQuery
protected abstract jakarta.persistence.Query doCreateCountQuery(JpaParametersParameterAccessor accessor) Creates aTypedQueryfor counting using the given values.- Parameters:
accessor- must not be null.- Returns:
-