Class AbstractJpaQuery
java.lang.Object
org.springframework.data.jpa.repository.query.AbstractJpaQuery
- All Implemented Interfaces:
RepositoryQuery
- Direct Known Subclasses:
PartTreeJpaQuery
Abstract base class to implement
RepositoryQuery
s.- Author:
- Oliver Gierke, Thomas Darimont, Mark Paluch, Christoph Strobl, Nicolas Cirigliano, Jens Schauder, Сергей Цыпанов, Wonchul Heo, Julia Lee, Yanming Zhou
-
Constructor Summary
ConstructorDescriptionAbstractJpaQuery
(JpaQueryMethod method, jakarta.persistence.EntityManager em) Creates a newAbstractJpaQuery
from 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 ParameterBinder
protected jakarta.persistence.Query
protected jakarta.persistence.Query
createQuery
(JpaParametersParameterAccessor parameters) protected abstract jakarta.persistence.Query
Creates aTypedQuery
for counting using the given values.protected abstract jakarta.persistence.Query
doCreateQuery
(JpaParametersParameterAccessor accessor) Creates aQuery
instance for the given values.protected jakarta.persistence.EntityManager
Returns theEntityManager
.protected JpaQueryExecution
protected JpaMetamodel
Returns theJpaMetamodel
.protected Class<?>
getTypeToRead
(ReturnedType returnedType) Returns the type to be used when creating the JPA query.
-
Constructor Details
-
AbstractJpaQuery
Creates a newAbstractJpaQuery
from the givenJpaQueryMethod
.- Parameters:
method
-em
-
-
-
Method Details
-
getQueryMethod
- Specified by:
getQueryMethod
in interfaceRepositoryQuery
-
getEntityManager
protected jakarta.persistence.EntityManager getEntityManager()Returns theEntityManager
.- Returns:
- will never be null.
-
getMetamodel
Returns theJpaMetamodel
.- Returns:
-
execute
- Specified by:
execute
in interfaceRepositoryQuery
-
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
Returns the type to be used when creating the JPA query.- Returns:
- Since:
- 2.0.5
-
doCreateQuery
Creates aQuery
instance for the given values.- Parameters:
accessor
- must not be null.- Returns:
-
doCreateCountQuery
protected abstract jakarta.persistence.Query doCreateCountQuery(JpaParametersParameterAccessor accessor) Creates aTypedQuery
for counting using the given values.- Parameters:
accessor
- must not be null.- Returns:
-