6.4 Query hint

In Cosminexus JPA Provider, you can specify a query hint in the hint element that is the lower element of the named-query element in the O/R mapping file. Note that you can also specify the query hint in the @Hint annotation of the argument for the @NamedQuery annotation. For details about the query hints specified in the annotations, see 2.7.53 @QueryHint in the manual uCosminexus Application Server API Reference Guide.

The following table describes the query hints that can be specified in the hint element that is the lower element of the named-query element in the O/R mapping file:

Table 6-68 Query hints that can be used in Cosminexus JPA Provider

Key nameDescriptionSpecifiable valueDefault
cosminexus.jpa.pessimistic-lockSpecifies whether the pessimistic lock will be used.
NoLock
The pessimistic lock will not be used.

Lock
The pessimistic lock will be used.
If the target table is already locked, the release of the lock will be awaited.
  • In Oracle
    SELECT ... FOR UPDATE will be issued.
  • In HiRDB
    SELECT ... WITH EXCLUSIVE LOCK will be issued.
LockNoWait
The pessimistic lock will be used.
If the target table is already locked, an exception will occur.
  • In Oracle
    SELECT ... FOR UPDATE NO WAIT will be issued.
  • In HiRDB
    SELECT ... WITH EXCLUSIVE LOCK NO WAIT will be issued.
NoLock
Note:
The data type that can be specified is String.
Note:
If a value outside the specifiable range is set for a query hint specified in the O/R mapping file, an exception will occur when the application starts. Note that the value is not case sensitive.