Package org.hibernate.annotations
Annotation 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:
- an association to an entity is fetched lazily,
- a collection is fetched lazily, or
- when an entity is retrieved using
Session.get(java.lang.Class<T>, java.lang.Object)
orSession.find(java.lang.Class<T>, java.lang.Object)
.
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:
-
Required Element Summary
Required Elements
-
Element Details
-
query
String queryThe HQLSELECT
statement.
-