Hibernate JPA @QueryHint Example
@QueryHint
The @QueryHint annotation is used to specify a JPA provider hint used by a @NamedQuery or a @NamedNativeQuery annotation.QueryHint Used to supply a query property or hint to the NamedQuery or NamedNativeQuery annotation.
Vendor-specific hints that are not recognized by a provider are ignored.
Fetching read-only entities using a named query and the read-only hint
@NamedQuery(name = "get_read_only_person_by_name",
query = "select p from Person p where name = :name",
hints = {
@QueryHint(
name = "org.hibernate.readOnly",
value = "true"
)
}
)
Comments
Post a Comment