Class JpaQueryMethod
java.lang.Object
org.springframework.data.repository.query.QueryMethod
org.springframework.data.jpa.repository.query.JpaQueryMethod
JPA specific extension of
QueryMethod.- Author:
- Oliver Gierke, Thomas Darimont, Christoph Strobl, Nicolas Cirigliano, Mark Paluch, Сергей Цыпанов, Réda Housni Alaoui, Greg Turnquist, Aleksei Elin
-
Constructor Summary
ConstructorsConstructorDescriptionJpaQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory, QueryExtractor extractor) Creates aJpaQueryMethod.JpaQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory, QueryExtractor extractor, Function<ParametersSource, JpaParameters> parametersFunction) Creates aJpaQueryMethod. -
Method Summary
Modifier and TypeMethodDescription@Nullable StringReturns the query string declared in aQueryannotation or null if neither the annotation found nor the attribute was specified.@Nullable StringReturns the countQuery string declared in aQueryannotation or null if neither the annotation found nor the attribute was specified.@Nullable DeclaredQueryReturns thedeclared count queryfrom aQueryannotation or null if neither the annotation found nor the attribute was specified.Returns the name of theNamedQuerythat shall be used for count queries.Returns theQueryExtractor.Returns theMetaattributes to be applied.Class<? extends QueryRewriter> Returns theQueryRewritertype.Returns the required query string declared in aQueryannotation or throwsIllegalStateExceptionif neither the annotation found nor the attribute was specified.Returns the requiredDeclaredQueryfrom aQueryannotation or throwsIllegalStateExceptionif neither the annotation found nor the attribute was specified.booleanbooleanbooleanReturns whether the finder is a modifying one.booleanReturn true if the method contains aProcedureannotation.Methods inherited from class QueryMethod
createParameters, getDomainClass, getName, getResultProcessor, getReturnedObjectType, isPageQuery, isQueryForEntity, isScrollQuery, isSearchQuery, isSliceQuery, isStreamQuery, toString
-
Constructor Details
-
JpaQueryMethod
public JpaQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory, QueryExtractor extractor) Creates aJpaQueryMethod.- Parameters:
method- must not be null.metadata- must not be null.factory- must not be null.extractor- must not be null.
-
JpaQueryMethod
public JpaQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory, QueryExtractor extractor, Function<ParametersSource, JpaParameters> parametersFunction) Creates aJpaQueryMethod.- Parameters:
method- must not be null.metadata- must not be null.factory- must not be null.extractor- must not be null.parametersFunction- function to obtainJpaParameters, must not be null.- Since:
- 3.5
-
-
Method Details
-
getEntityInformation
- Overrides:
getEntityInformationin classQueryMethod
-
isModifyingQuery
public boolean isModifyingQuery()Returns whether the finder is a modifying one.- Overrides:
isModifyingQueryin classQueryMethod- Returns:
-
getQueryExtractor
-
hasQueryMetaAttributes
public boolean hasQueryMetaAttributes()- Returns:
- return true if
Metaannotation is available. - Since:
- 3.0
-
getQueryMetaAttributes
-
getAnnotatedQuery
-
getRequiredAnnotatedQuery
Returns the required query string declared in aQueryannotation or throwsIllegalStateExceptionif neither the annotation found nor the attribute was specified.- Returns:
- Throws:
IllegalStateException- if noQueryannotation is present or the query is empty.- Since:
- 2.0
-
getRequiredDeclaredQuery
Returns the requiredDeclaredQueryfrom aQueryannotation or throwsIllegalStateExceptionif neither the annotation found nor the attribute was specified.- Returns:
- Throws:
IllegalStateException- if noQueryannotation is present or the query is empty.- Since:
- 4.0
-
getCountQuery
-
getDeclaredCountQuery
Returns thedeclared count queryfrom aQueryannotation or null if neither the annotation found nor the attribute was specified.- Returns:
- Since:
- 4.0
-
getNamedQueryName
- Overrides:
getNamedQueryNamein classQueryMethod
-
getNamedCountQueryName
Returns the name of theNamedQuerythat shall be used for count queries.- Returns:
-
getParameters
- Overrides:
getParametersin classQueryMethod
-
isCollectionQuery
public boolean isCollectionQuery()- Overrides:
isCollectionQueryin classQueryMethod
-
isProcedureQuery
public boolean isProcedureQuery()Return true if the method contains aProcedureannotation.- Returns:
-
getQueryRewriter
Returns theQueryRewritertype.- Returns:
- type of the
QueryRewriter - Since:
- 3.0
-