Spring Data Jpa

org.springframework.data.jpa.repository
Annotation Type Query


@Retention(value=RUNTIME)
@Target(value=METHOD)
@Documented
public @interface Query

Annotation to declare finder queries directly on repository methods.

Author:
Oliver Gierke

Optional Element Summary
 String countName
          Returns the name of the NamedQuery to be used to execute count queries when pagination is used.
 String countQuery
          Defines a special count query that shall be used for pagination queries to lookup the total number of elements for a page.
 String name
          The named query to be used.
 boolean nativeQuery
          Configures whether the given query is a native one.
 String value
          Defines the JPA query to be executed when the annotated method is called.
 

value

public abstract String value
Defines the JPA query to be executed when the annotated method is called.

Default:
""

countQuery

public abstract 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 non is configured we will derive the count query from the method name.

Default:
""

nativeQuery

public abstract boolean nativeQuery
Configures whether the given query is a native one. Defaults to false.

Default:
false

name

public abstract String name
The named query to be used. If not defined, a NamedQuery with name of $ domainClass.${queryMethodName}} will be used.

Default:
""

countName

public abstract 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:
name()
Default:
""

Spring Data Jpa

Copyright © 2011-2012-2012 SpringSource. All Rights Reserved.