Annotation Interface Query


Annotation to declare finder queries directly on repository methods.
Author:
Oliver Gierke, Thomas Darimont, Christoph Strobl, Greg Turnquist
See Also:
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Returns the name of the NamedQuery 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 lookup 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 a QueryRewriter 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 value
      Defines the JPA query to be executed when the annotated method is called.
      Default:
      ""
    • countQuery

      String countQuery
      Defines a special count query that shall be used for pagination queries to lookup the total number of elements for a page. If none is configured we will derive the count query from the original query or countProjection() query if any.
      Default:
      ""
    • countProjection

      String countProjection
      Defines the projection part of the count query that is generated for pagination. If neither countQuery() nor countProjection() is configured we will derive the count query from the original query.
      Returns:
      Since:
      1.6
      Default:
      ""
    • nativeQuery

      boolean nativeQuery
      Configures whether the given query is a native one. Defaults to false.
      Default:
      false
    • name

      String name
      The named query to be used. If not defined, a NamedQuery with name of $ domainClass.${queryMethodName}} will be used.
      Default:
      ""
    • countName

      String countName
      Returns the name of the NamedQuery 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> queryRewriter
      Define a QueryRewriter 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