uCosminexus Application Server, API Reference Guide

[Contents][Index][Back][Next]

2.7.53 @QueryHint

Organization of this subsection
(1) Description
(2) Element

(1) Description

This annotation specifies a database--specific query hint.

You can set up a pessimistic lock and the cache functionality of the entity.

The applicable target is the hints element of @NamedQuery or @NamedNativeQuery.

(2) Element

The following table lists the elements of @QueryHint:

Element name Optional/Required Element description
name Required This element specifies the name of the hint.
value Required This element specifies the value of the hint.

The details of attributes that are supported with Cosminexus JPA provider are as follows:

(a) name element

Type
String

Description
This element specifies the name of the hint to be used. The following value can be specified:
cosminexus.jpa.pessimistic-lock
This is the name of the hint that specifies whether or not to use a pessimistic lock.

Default value
None
(b) value element

Type
String

Description
This element specifies the value of the hint. The following values are specified based on the name of the hint specified in the name element:
Specification value when cosminexus.jpa.pessimistic-lock is specified in the name element
  • NoLock: Specified when the pessimistic lock is not used.
  • Lock: Specified when the pessimistic lock is used. If the target table is already locked, unlocking is awaited. The SQLs issued at this point are specified as follows, for each used database:
    In Oracle: SELECT.... FOR UPDATE
    In HiRDB: SELECT....WITH EXCLUSIVE LOCK
  • LockNoWait: Specified when the pessimistic lock is used. If the target table is already locked, an exception occurs. The SQLs issued at this point are specified as follows, for each used database:
    In Oracle: SELECT.... FOR UPDATE NO WAIT
    In HiRDB: SELECT....WITH EXCLUSIVE LOCK NO WAIT

Default value
When cosminexus.jpa.pessimistic-lock is specified in the name element
NoLock