Annotation Interface NamedQuery


@Target({TYPE,PACKAGE}) @Retention(RUNTIME) @Repeatable(NamedQueries.class) public @interface NamedQuery
Declares a named query written in HQL or JPQL.

Whereas the JPA-standard @NamedQuery annotation allows custom settings specific to Hibernate to be specified via stringly-typed query hints, this annotation is completely typesafe.

Note that the members of this annotation correspond to hints enumerated by AvailableHints.

See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The name of this query.
    The text of the HQL query.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether the query results are cacheable.
    The cache interaction mode for this query.
    If the query results are cacheable, the name of the query cache region.
    The cache retrieval mode for objects returned by this query.
    The cache storage mode for objects returned by this query.
    A comment added to the generated SQL query.
    int
    The number of rows fetched by the JDBC driver per trip.
    Determines whether the session should be flushed before executing the query.
    boolean
    Whether the results should be loaded in read-only mode.
    Optional query result class that is used by default when creating the query.
    int
    The query timeout in seconds.