9.16.5 Specifying a query hint
During the execution of a query, you can specify a query hint as a vendor-dependent hint. With Cosminexus JPA Provider, you specify a query hint when you use the pessimistic lock.
Specify the query hint at the following locations:
-
The argument of the setHint() method of the Query object
-
The argument @Hint of @NamedQuery
-
The <hint> tag that is a lower element of the <named-query> tag in the O/R mapping file
If you specify a value outside the range specifiable in the query hint, an exception occurs. Note that the specified value is not case sensitive.
The time when an exception occurs differs depending on the location where the query hint is specified. The timing for the occurrence of an exception is as follows:
-
In the setHint() method, when the application query is executed
-
In the annotation, when the application is deployed
-
In the O/R mapping file, when the application starts
For details on the query hints supported by CJPA provider, see 9.22 Scope of support for the annotations included in the javax.persistence package when using annotations, and see 13.3 O/R mapping files when using O/R mapping files.