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 LockOptionsgetLockOptions()The locking options for the loaded entityTgetReference(Object naturalIdValue)Return the persistent instance with the given natural id value, assuming that the instance exists.booleanisSynchronizationEnabled()Whether Hibernate should perform "synchronization" prior to performing look-ups?Tload(Object naturalIdValue)Return the persistent instance with the given natural id value, ornullif there is no such persistent instance.Optional<T>loadOptional(Object naturalIdValue)Same semantic asSimpleNaturalIdLoadAccess.load(java.lang.Object)except that hereOptionalis returned to handle nullability.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).SimpleNaturalIdLoadAccessImpl<T>with(LockOptions lockOptions)Specify theLockOptionsto use when retrieving the entity.-
Methods inherited from class org.hibernate.loader.internal.BaseNaturalIdLoadAccessImpl
doGetReference, doLoad, entityPersister, getContext, getEntityDescriptor, getIdentifierLoadAccess, performAnyNeededCrossReferenceSynchronizations, resolveNaturalId, synchronizationEnabled
-
-
-
-
Constructor Detail
-
SimpleNaturalIdLoadAccessImpl
public SimpleNaturalIdLoadAccessImpl(LoadAccessContext context, EntityMappingType entityDescriptor)
-
-
Method Detail
-
getLockOptions
public LockOptions getLockOptions()
Description copied from interface:NaturalIdLoadOptionsThe locking options for the loaded entity- Specified by:
getLockOptionsin interfaceNaturalIdLoadOptions- Overrides:
getLockOptionsin classBaseNaturalIdLoadAccessImpl<T>
-
isSynchronizationEnabled
public boolean isSynchronizationEnabled()
Description copied from interface:NaturalIdLoadOptionsWhether Hibernate should perform "synchronization" prior to performing look-ups?- Specified by:
isSynchronizationEnabledin interfaceNaturalIdLoadOptions- Overrides:
isSynchronizationEnabledin classBaseNaturalIdLoadAccessImpl<T>
-
with
public final SimpleNaturalIdLoadAccessImpl<T> with(LockOptions lockOptions)
Description copied from interface:SimpleNaturalIdLoadAccessSpecify theLockOptionsto use when retrieving the entity.- Specified by:
within interfaceSimpleNaturalIdLoadAccess<T>- Overrides:
within 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:SimpleNaturalIdLoadAccessFor 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:
setSynchronizationEnabledin interfaceSimpleNaturalIdLoadAccess<T>- Parameters:
synchronizationEnabled- Should synchronization be performed?trueindicates synchronization will be performed;falseindicates it will be circumvented.- Returns:
this, for method chaining
-
getReference
public T getReference(Object naturalIdValue)
Description copied from interface:SimpleNaturalIdLoadAccessReturn 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, useSimpleNaturalIdLoadAccess.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:
getReferencein interfaceSimpleNaturalIdLoadAccess<T>- Parameters:
naturalIdValue- The value of the natural-id for the entity to retrieve- Returns:
- The persistent instance or proxy, if an instance exists. Otherwise,
null.
-
load
public T load(Object naturalIdValue)
Description copied from interface:SimpleNaturalIdLoadAccessReturn the persistent instance with the given natural id value, ornullif 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:
loadin interfaceSimpleNaturalIdLoadAccess<T>- Parameters:
naturalIdValue- The value of the natural-id for the entity to retrieve- Returns:
- The persistent instance or
null
-
loadOptional
public Optional<T> loadOptional(Object naturalIdValue)
Description copied from interface:SimpleNaturalIdLoadAccessSame semantic asSimpleNaturalIdLoadAccess.load(java.lang.Object)except that hereOptionalis returned to handle nullability.- Specified by:
loadOptionalin interfaceSimpleNaturalIdLoadAccess<T>- Parameters:
naturalIdValue- The identifier- Returns:
- The persistent instance, if one, wrapped in Optional
-
-