Package org.hibernate.loader.internal
Class IdentifierLoadAccessImpl<T>
java.lang.Object
org.hibernate.loader.internal.IdentifierLoadAccessImpl<T>
- All Implemented Interfaces:
IdentifierLoadAccess<T>
,JavaType.CoercionContext
public class IdentifierLoadAccessImpl<T>
extends Object
implements IdentifierLoadAccess<T>, JavaType.CoercionContext
Standard implementation of load-by-id
-
Constructor Summary
ConstructorsConstructorDescriptionIdentifierLoadAccessImpl
(LoadAccessContext context, EntityPersister entityPersister) -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
coerceId
(Object id, SessionFactoryImplementor factory) disableFetchProfile
(String profileName) Customize the associations fetched by specifying a fetch profile that should be disabled during this operation.protected T
doGetReference
(Object id) protected T
enableFetchProfile
(String profileName) Customize the associations fetched by specifying a fetch profile that should be enabled during this operation.protected CacheMode
protected LoadAccessContext
protected EntityPersister
protected GraphSemantic
protected LockOptions
final T
getReference
(Object id) Return the persistent instance with the given identifier, assuming that the instance exists.protected Boolean
isReadOnly
(SessionImplementor session) final T
Return the persistent instance with the given identifier, or null if there is no such persistent instance.loadOptional
(Object id) Just likeIdentifierLoadAccess.load(java.lang.Object)
, except that here anOptional
is returned.protected T
with
(EntityGraph<T> graph, GraphSemantic semantic) Customize the associations fetched by specifying an entity graph, and how it should be interpreted.Specify the timeout to use when querying the database.Specify theCacheMode
to use when obtaining an entity.with
(LockMode lockMode, PessimisticLockScope lockScope) Specify the lock mode to use when querying the database.final IdentifierLoadAccessImpl<T>
with
(LockOptions lockOptions) Specify the lock options to use when querying the database.withReadOnly
(boolean readOnly) Specify whether the entity should be loaded in read-only mode.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hibernate.IdentifierLoadAccess
with, with, withFetchGraph, withLoadGraph
-
Constructor Details
-
IdentifierLoadAccessImpl
-
-
Method Details
-
with
Description copied from interface:IdentifierLoadAccess
Specify the lock options to use when querying the database.- Specified by:
with
in interfaceIdentifierLoadAccess<T>
- Parameters:
lockOptions
- The lock options to use- Returns:
this
, for method chaining
-
with
Description copied from interface:IdentifierLoadAccess
Specify the lock mode to use when querying the database.- Specified by:
with
in interfaceIdentifierLoadAccess<T>
- Parameters:
lockMode
- The lock mode to apply- Returns:
this
, for method chaining
-
with
Description copied from interface:IdentifierLoadAccess
Specify the timeout to use when querying the database.- Specified by:
with
in interfaceIdentifierLoadAccess<T>
- Parameters:
timeout
- The timeout to apply to the database operation- Returns:
this
, for method chaining
-
with
Description copied from interface:IdentifierLoadAccess
Specify theCacheMode
to use when obtaining an entity.- Specified by:
with
in interfaceIdentifierLoadAccess<T>
- Parameters:
cacheMode
- TheCacheMode
to use- Returns:
this
, for method chaining
-
withReadOnly
Description copied from interface:IdentifierLoadAccess
Specify whether the entity should be loaded in read-only mode.- Specified by:
withReadOnly
in interfaceIdentifierLoadAccess<T>
- See Also:
-
with
Description copied from interface:IdentifierLoadAccess
Customize the associations fetched by specifying an entity graph, and how it should be interpreted.- Specified by:
with
in interfaceIdentifierLoadAccess<T>
-
getReference
Description copied from interface:IdentifierLoadAccess
Return the persistent instance with the given identifier, assuming that the instance exists. This method might return a proxied instance that is initialized on-demand, when a non-identifier method is accessed.You should not use this method to determine if an instance exists; to check for existence, use
IdentifierLoadAccess.load(java.lang.Object)
instead. Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.- Specified by:
getReference
in interfaceIdentifierLoadAccess<T>
- Parameters:
id
- The identifier for which to obtain a reference- Returns:
- the persistent instance or proxy
-
perform
-
doGetReference
-
isReadOnly
-
load
Description copied from interface:IdentifierLoadAccess
Return the persistent instance with the given identifier, or null if there is no such persistent instance. If the instance is already associated with the session, return that instance, initializing it if needed. This method never returns an uninitialized instance.- Specified by:
load
in interfaceIdentifierLoadAccess<T>
- Parameters:
id
- The identifier- Returns:
- The persistent instance or
null
-
loadOptional
Description copied from interface:IdentifierLoadAccess
Just likeIdentifierLoadAccess.load(java.lang.Object)
, except that here anOptional
is returned.- Specified by:
loadOptional
in interfaceIdentifierLoadAccess<T>
- Parameters:
id
- The identifier- Returns:
- The persistent instance, if any, as an
Optional
-
doLoad
-
coerceId
-
getTypeConfiguration
- Specified by:
getTypeConfiguration
in interfaceJavaType.CoercionContext
-
enableFetchProfile
Description copied from interface:IdentifierLoadAccess
Customize the associations fetched by specifying a fetch profile that should be enabled during this operation.This allows the session-level fetch profiles to be temporarily overridden.
- Specified by:
enableFetchProfile
in interfaceIdentifierLoadAccess<T>
-
disableFetchProfile
Description copied from interface:IdentifierLoadAccess
Customize the associations fetched by specifying a fetch profile that should be disabled during this operation.This allows the session-level fetch profiles to be temporarily overridden.
- Specified by:
disableFetchProfile
in interfaceIdentifierLoadAccess<T>
-
getCacheMode
-
getGraphSemantic
-
getContext
-
getEntityPersister
-
getLockOptions
-
getRootGraph
-