Annotation Interface HQLSelect


@Target({TYPE,FIELD,METHOD}) @Retention(RUNTIME) public @interface HQLSelect
Specifies a custom HQL/JPQL query to be used in place of the default SQL generated by Hibernate when an entity or collection is fetched from the database by id. This occurs when:

The given HQL query must have exactly one parameter which accepts the id of the entity or of the entity which owns the collection. It must return a single item in the select list, and that item must be the correct type of entity or collection element.

Since:
6.2
See Also:
Implementation Note:
This annotation is just an abbreviation for Loader together with NamedQuery.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The HQL SELECT statement.
  • Element Details

    • query

      String query
      The HQL SELECT statement.