Annotation Interface Query
Annotation to declare finder queries directly on repository query methods.
When using a native query, a @NativeQuery
variant is available.
- Author:
- Oliver Gierke, Thomas Darimont, Christoph Strobl, Greg Turnquist, Danny van den Elshout
- See Also:
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionReturns the name of theNamedQuery
to be used to execute count queries when pagination is used.Defines the projection part of the count query that is generated for pagination.Defines a special count query that shall be used for pagination queries to look up the total number of elements for a page.The named query to be used.boolean
Configures whether the given query is a native one.Class<? extends QueryRewriter>
Define aQueryRewriter
that should be applied to the query string after the query is fully assembled.Defines the JPA query to be executed when the annotated method is called.
-
Element Details
-
value
String valueDefines the JPA query to be executed when the annotated method is called.- Default:
- ""
-
countQuery
String countQueryDefines a special count query that shall be used for pagination queries to look up the total number of elements for a page. If none is configured we will derive the count query from the original query orcountProjection()
query if any.- Default:
- ""
-
countProjection
String countProjectionDefines the projection part of the count query that is generated for pagination. If neithercountQuery()
norcountProjection()
is configured we will derive the count query from the original query.- Returns:
- Since:
- 1.6
- Default:
- ""
-
nativeQuery
boolean nativeQueryConfigures whether the given query is a native one. Defaults to false.- Default:
- false
-
name
String nameThe named query to be used. If not defined, aNamedQuery
with name of${domainClass}.${queryMethodName}
will be used.- Default:
- ""
-
countName
String countNameReturns the name of theNamedQuery
to be used to execute count queries when pagination is used. Will default to the named query name configured suffixed by.count
.- Returns:
- See Also:
- Default:
- ""
-
queryRewriter
Class<? extends QueryRewriter> queryRewriterDefine aQueryRewriter
that should be applied to the query string after the query is fully assembled.- Returns:
- Since:
- 3.0
- Default:
- org.springframework.data.jpa.repository.QueryRewriter.IdentityQueryRewriter.class
-