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
RepositoryQuerys.- Author:
- Oliver Gierke, Thomas Darimont, Mark Paluch, Christoph Strobl, Nicolas Cirigliano, Jens Schauder, Сергей Цыпанов, Wonchul Heo, Julia Lee, Yanming Zhou
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionAbstractJpaQuery(JpaQueryMethod method, EntityManager em) Creates a newAbstractJpaQueryfrom the givenJpaQueryMethod. -
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends Query>
TapplyHints(T query, JpaQueryMethod method) Applies the declared query hints to the given query.protected <T extends Query>
voidapplyQueryHint(T query, QueryHint hint) Protected to be able to customize in sub-classes.protected Queryprotected QuerycreateQuery(JpaParametersParameterAccessor parameters) protected abstract QueryCreates aTypedQueryfor counting using the given values.protected abstract QuerydoCreateQuery(JpaParametersParameterAccessor accessor) Creates aQueryinstance for the given values.protected EntityManagerReturns theEntityManager.protected JpaQueryExecutiongetExecution(JpaParametersParameterAccessor accessor) protected JpaMetamodelReturns theJpaMetamodel.getTypeToRead(ReturnedType returnedType) Returns the type to be used when creating the JPA query.abstract booleanReturns true if the query has a dedicated count query associated with it or false if the count query shall be derived.
-
Constructor Details
-
AbstractJpaQuery
Creates a newAbstractJpaQueryfrom the givenJpaQueryMethod.- Parameters:
method-em-
-
-
Method Details
-
getQueryMethod
- Specified by:
getQueryMethodin interfaceRepositoryQuery
-
hasDeclaredCountQuery
public abstract boolean hasDeclaredCountQuery()Returns true if the query has a dedicated count query associated with it or false if the count query shall be derived.- Returns:
- true if the query has a dedicated count query false if the * count query is derived.
- Since:
- 3.5
-
getEntityManager
-
getMetamodel
-
execute
- Specified by:
executein interfaceRepositoryQuery
-
getExecution
-
applyHints
@Contract("_, _ -> param1") protected <T extends Query> T applyHints(T query, JpaQueryMethod method) Applies the declared query hints to the given query.- Parameters:
query-- Returns:
-
applyQueryHint
-
createQuery
-
createCountQuery
-
getTypeToRead
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
Creates aTypedQueryfor counting using the given values.- Parameters:
accessor- must not be null.- Returns:
-