Annotation Interface ReadQueryOptions
Configures options that affect the execution of a database read operation. This annotation may be applied to:
- a method with a
StaticQueryor Jakarta Datajakarta.data.repository.Queryannotation whosevaluemember specifies aSELECTstatement, - a method with a
StaticNativeQueryannotation whosevaluemember specifies a SQL operation which returns a result set, or - a Jakarta Data repository method annotated
jakarta.data.repository.Find.
This annotation must be respected by an implementation of Jakarta Data backed by Jakarta Persistence.
- Since:
- 4.0
- See Also:
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionThe cache retrieve mode to use.The cache store mode to use.The name of aNamedEntityGraphapplied to the entity returned by the query.Query properties and hints.The lock mode type to use in query execution.The pessimistic lock scope to use in query execution if a pessimistic lock mode is specified vialockMode().intA query timeout in milliseconds.
-
Element Details
-
cacheStoreMode
CacheStoreMode cacheStoreModeThe cache store mode to use. The presence of this annotation overrides the default cache store mode of the persistence context.- See Also:
- Default:
USE
-
cacheRetrieveMode
CacheRetrieveMode cacheRetrieveModeThe cache retrieve mode to use. The presence of this annotation overrides the default cache retrieve mode of the persistence context.- See Also:
- Default:
USE
-
timeout
int timeoutA query timeout in milliseconds. By default, there is no timeout.- See Also:
- Default:
-1
-
hints
QueryHint[] hintsQuery properties and hints. May include vendor-specific query hints.- See Also:
- Default:
{}
-
lockMode
LockModeType lockModeThe lock mode type to use in query execution. If alockModeother thanLockModeType.NONEis specified, the query must be executed in a transaction and the persistence context joined to the transaction.If a lock mode is explicitly specified for a native query, the behavior is undefined and unportable between persistence providers.
- See Also:
- Default:
NONE
-
lockScope
PessimisticLockScope lockScopeThe pessimistic lock scope to use in query execution if a pessimistic lock mode is specified vialockMode().- Default:
NORMAL
-
entityGraph
String entityGraphThe name of aNamedEntityGraphapplied to the entity returned by the query. By default, no entity graph is applied. The named entity graph must be an entity graph compatible with the entity type returned by the query. If the result type of the query is not an entity type, the behavior is undefined. The entity graph is interpreted as a load graph. The entity graph specified here may be overridden by callingsetEntityGraph().- See Also:
- Default:
""
-