Package org.hibernate.loader.internal
Class SimpleNaturalIdLoadAccessImpl<T>
- java.lang.Object
-
- org.hibernate.loader.internal.BaseNaturalIdLoadAccessImpl<T>
-
- org.hibernate.loader.internal.SimpleNaturalIdLoadAccessImpl<T>
-
- All Implemented Interfaces:
NaturalIdLoadOptions
,SimpleNaturalIdLoadAccess<T>
public class SimpleNaturalIdLoadAccessImpl<T> extends BaseNaturalIdLoadAccessImpl<T> implements SimpleNaturalIdLoadAccess<T>
-
-
Field Summary
-
Fields inherited from interface org.hibernate.loader.ast.spi.NaturalIdLoadOptions
NONE
-
-
Constructor Summary
Constructors Constructor Description SimpleNaturalIdLoadAccessImpl(LoadAccessContext context, EntityMappingType entityDescriptor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpleNaturalIdLoadAccess<T>
disableFetchProfile(String profileName)
Customize the associations fetched by specifying a fetch profile that should be disabled during this operation.SimpleNaturalIdLoadAccess<T>
enableFetchProfile(String profileName)
Customize the associations fetched by specifying a fetch profile that should be enabled during this operation.LockOptions
getLockOptions()
The locking options for the loaded entityT
getReference(Object naturalIdValue)
Return the persistent instance with the given natural id value, assuming that the instance exists.boolean
isSynchronizationEnabled()
Whether Hibernate should perform "synchronization" prior to performing look-ups?T
load(Object naturalIdValue)
Return the persistent instance with the given natural id value, ornull
if there is no such persistent instance.Optional<T>
loadOptional(Object naturalIdValue)
Just likeSimpleNaturalIdLoadAccess.load(java.lang.Object)
, except that here anOptional
is returned.SimpleNaturalIdLoadAccessImpl<T>
setSynchronizationEnabled(boolean synchronizationEnabled)
For entities with mutable natural ids, should Hibernate perform "synchronization" prior to performing lookups? The default is to perform "synchronization" (for correctness).SimpleNaturalIdLoadAccess<T>
with(RootGraph<T> graph, GraphSemantic semantic)
Customize the associations fetched by specifying an entity graph, and how it should be interpreted.SimpleNaturalIdLoadAccessImpl<T>
with(LockOptions lockOptions)
Specify the lock options to use when querying the database.SimpleNaturalIdLoadAccess<T>
withLoadGraph(RootGraph<T> graph)
Augment the associations fetched by default by specifying a list of additional associations to be fetched as an entity graph.-
Methods inherited from class org.hibernate.loader.internal.BaseNaturalIdLoadAccessImpl
doGetReference, doLoad, entityPersister, getContext, getEntityDescriptor, getIdentifierLoadAccess, performAnyNeededCrossReferenceSynchronizations, synchronizationEnabled
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.SimpleNaturalIdLoadAccess
withFetchGraph
-
-
-
-
Constructor Detail
-
SimpleNaturalIdLoadAccessImpl
public SimpleNaturalIdLoadAccessImpl(LoadAccessContext context, EntityMappingType entityDescriptor)
-
-
Method Detail
-
getLockOptions
public LockOptions getLockOptions()
Description copied from interface:NaturalIdLoadOptions
The locking options for the loaded entity- Specified by:
getLockOptions
in interfaceNaturalIdLoadOptions
- Overrides:
getLockOptions
in classBaseNaturalIdLoadAccessImpl<T>
-
isSynchronizationEnabled
public boolean isSynchronizationEnabled()
Description copied from interface:NaturalIdLoadOptions
Whether Hibernate should perform "synchronization" prior to performing look-ups?- Specified by:
isSynchronizationEnabled
in interfaceNaturalIdLoadOptions
- Overrides:
isSynchronizationEnabled
in classBaseNaturalIdLoadAccessImpl<T>
-
with
public final SimpleNaturalIdLoadAccessImpl<T> with(LockOptions lockOptions)
Description copied from interface:SimpleNaturalIdLoadAccess
Specify the lock options to use when querying the database.- Specified by:
with
in interfaceSimpleNaturalIdLoadAccess<T>
- Overrides:
with
in classBaseNaturalIdLoadAccessImpl<T>
- Parameters:
lockOptions
- The lock options to use- Returns:
this
, for method chaining
-
setSynchronizationEnabled
public SimpleNaturalIdLoadAccessImpl<T> setSynchronizationEnabled(boolean synchronizationEnabled)
Description copied from interface:SimpleNaturalIdLoadAccess
For entities with mutable natural ids, should Hibernate perform "synchronization" prior to performing lookups? The default is to perform "synchronization" (for correctness).See
NaturalIdLoadAccess.setSynchronizationEnabled(boolean)
for detailed discussion.- Specified by:
setSynchronizationEnabled
in interfaceSimpleNaturalIdLoadAccess<T>
- Parameters:
synchronizationEnabled
- Should synchronization be performed?true
indicates synchronization will be performed;false
indicates it will be circumvented.- Returns:
this
, for method chaining
-
getReference
public T getReference(Object naturalIdValue)
Description copied from interface:SimpleNaturalIdLoadAccess
Return the persistent instance with the given natural id value, 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
SimpleNaturalIdLoadAccess.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 interfaceSimpleNaturalIdLoadAccess<T>
- Parameters:
naturalIdValue
- The value of the natural id- Returns:
- The persistent instance or proxy, if an instance exists.
Otherwise,
null
.
-
load
public T load(Object naturalIdValue)
Description copied from interface:SimpleNaturalIdLoadAccess
Return the persistent instance with the given natural id value, ornull
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 interfaceSimpleNaturalIdLoadAccess<T>
- Parameters:
naturalIdValue
- The value of the natural-id- Returns:
- The persistent instance or
null
-
loadOptional
public Optional<T> loadOptional(Object naturalIdValue)
Description copied from interface:SimpleNaturalIdLoadAccess
Just likeSimpleNaturalIdLoadAccess.load(java.lang.Object)
, except that here anOptional
is returned.- Specified by:
loadOptional
in interfaceSimpleNaturalIdLoadAccess<T>
- Parameters:
naturalIdValue
- The identifier- Returns:
- The persistent instance, if any, as an
Optional
-
with
public SimpleNaturalIdLoadAccess<T> with(RootGraph<T> graph, GraphSemantic semantic)
Description copied from interface:SimpleNaturalIdLoadAccess
Customize the associations fetched by specifying an entity graph, and how it should be interpreted.- Specified by:
with
in interfaceSimpleNaturalIdLoadAccess<T>
- Overrides:
with
in classBaseNaturalIdLoadAccessImpl<T>
-
withLoadGraph
public SimpleNaturalIdLoadAccess<T> withLoadGraph(RootGraph<T> graph)
Description copied from interface:SimpleNaturalIdLoadAccess
Augment the associations fetched by default by specifying a list of additional associations to be fetched as an entity graph.- Specified by:
withLoadGraph
in interfaceSimpleNaturalIdLoadAccess<T>
-
enableFetchProfile
public SimpleNaturalIdLoadAccess<T> enableFetchProfile(String profileName)
Description copied from interface:SimpleNaturalIdLoadAccess
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 interfaceSimpleNaturalIdLoadAccess<T>
- Overrides:
enableFetchProfile
in classBaseNaturalIdLoadAccessImpl<T>
-
disableFetchProfile
public SimpleNaturalIdLoadAccess<T> disableFetchProfile(String profileName)
Description copied from interface:SimpleNaturalIdLoadAccess
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 interfaceSimpleNaturalIdLoadAccess<T>
- Overrides:
disableFetchProfile
in classBaseNaturalIdLoadAccessImpl<T>
-
-