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
RepositoryQuery
s.- Author:
- Oliver Gierke, Thomas Darimont, Mark Paluch, Christoph Strobl, Nicolas Cirigliano, Jens Schauder, Сергей Цыпанов, Wonchul Heo, Julia Lee
-
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
(org.springframework.data.repository.query.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 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:
execute
in 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 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:
-