Class NaturalIdMultiLoadAccessStandard<T>
- java.lang.Object
-
- org.hibernate.internal.NaturalIdMultiLoadAccessStandard<T>
-
- All Implemented Interfaces:
MultiLoadOptions,MultiNaturalIdLoadOptions,NaturalIdMultiLoadAccess<T>
public class NaturalIdMultiLoadAccessStandard<T> extends Object implements NaturalIdMultiLoadAccess<T>, MultiNaturalIdLoadOptions
-
-
Constructor Summary
Constructors Constructor Description NaturalIdMultiLoadAccessStandard(EntityPersister entityDescriptor, SessionImpl session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NaturalIdMultiLoadAccess<T>enableOrderedReturn(boolean enabled)Should the return List be ordered and positional in relation to the incoming ids? If enabled (the default), the return List is ordered and positional relative to the incoming ids.NaturalIdMultiLoadAccess<T>enableReturnOfDeletedEntities(boolean enabled)Should the multi-load operation be allowed to return entities that are locally deleted? A locally deleted entity is one which has been passed to this Session'sSession.delete(java.lang.Object)/Session.remove(java.lang.Object)method, but not yet flushed.IntegergetBatchSize()Batch size to use when loading entities from the database.LockOptionsgetLockOptions()Specify the lock options applied during loading.booleanisOrderReturnEnabled()Should the entities be returned in the same order as their associated entity identifiers were provided.booleanisReturnOfDeletedEntitiesEnabled()Should we returned entities that are scheduled for deletion.List<T>multiLoad(Object... ids)Perform a load of multiple entities by natural-id.List<T>multiLoad(List<?> ids)Perform a load of multiple entities by natural-id.NaturalIdMultiLoadAccess<T>with(CacheMode cacheMode)Specify theCacheModeto use when retrieving the entity.NaturalIdMultiLoadAccess<T>with(RootGraph<T> graph, GraphSemantic semantic)Define a load or fetch graph to be used when retrieving the entityNaturalIdMultiLoadAccess<T>with(LockOptions lockOptions)Specify theLockOptionsto use when retrieving the entity.NaturalIdMultiLoadAccess<T>withBatchSize(int batchSize)Specify a batch size for loading the entities (how many at a time).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.NaturalIdMultiLoadAccess
with
-
-
-
-
Constructor Detail
-
NaturalIdMultiLoadAccessStandard
public NaturalIdMultiLoadAccessStandard(EntityPersister entityDescriptor, SessionImpl session)
-
-
Method Detail
-
with
public NaturalIdMultiLoadAccess<T> with(LockOptions lockOptions)
Description copied from interface:NaturalIdMultiLoadAccessSpecify theLockOptionsto use when retrieving the entity.- Specified by:
within interfaceNaturalIdMultiLoadAccess<T>- Parameters:
lockOptions- The lock options to use.- Returns:
this, for method chaining
-
with
public NaturalIdMultiLoadAccess<T> with(CacheMode cacheMode)
Description copied from interface:NaturalIdMultiLoadAccessSpecify theCacheModeto use when retrieving the entity.- Specified by:
within interfaceNaturalIdMultiLoadAccess<T>- Parameters:
cacheMode- The CacheMode to use.- Returns:
this, for method chaining
-
with
public NaturalIdMultiLoadAccess<T> with(RootGraph<T> graph, GraphSemantic semantic)
Description copied from interface:NaturalIdMultiLoadAccessDefine a load or fetch graph to be used when retrieving the entity- Specified by:
within interfaceNaturalIdMultiLoadAccess<T>
-
withBatchSize
public NaturalIdMultiLoadAccess<T> withBatchSize(int batchSize)
Description copied from interface:NaturalIdMultiLoadAccessSpecify a batch size for loading the entities (how many at a time). The default is to use a batch sizing strategy defined by the Dialect in use. Any greater-than-one value here will override that default behavior. If giving an explicit value here, care should be taken to not exceed the capabilities of the underlying database.Note that overall a batch-size is considered a hint.
- Specified by:
withBatchSizein interfaceNaturalIdMultiLoadAccess<T>- Parameters:
batchSize- The batch size- Returns:
this, for method chaining
-
enableReturnOfDeletedEntities
public NaturalIdMultiLoadAccess<T> enableReturnOfDeletedEntities(boolean enabled)
Description copied from interface:NaturalIdMultiLoadAccessShould the multi-load operation be allowed to return entities that are locally deleted? A locally deleted entity is one which has been passed to this Session'sSession.delete(java.lang.Object)/Session.remove(java.lang.Object)method, but not yet flushed. The default behavior is to handle them as null in the return (seeNaturalIdMultiLoadAccess.enableOrderedReturn(boolean)).- Specified by:
enableReturnOfDeletedEntitiesin interfaceNaturalIdMultiLoadAccess<T>- Parameters:
enabled-trueenables returning the deleted entities;false(the default) disables it.- Returns:
this, for method chaining
-
enableOrderedReturn
public NaturalIdMultiLoadAccess<T> enableOrderedReturn(boolean enabled)
Description copied from interface:NaturalIdMultiLoadAccessShould the return List be ordered and positional in relation to the incoming ids? If enabled (the default), the return List is ordered and positional relative to the incoming ids. In other words, a request tomultiLoad([2,1,3])will return[Entity#2, Entity#1, Entity#3].An important distinction is made here in regards to the handling of unknown entities depending on this "ordered return" setting. If enabled a null is inserted into the List at the proper position(s). If disabled, the nulls are not put into the return List. In other words, consumers of the returned ordered List would need to be able to handle null elements.
- Specified by:
enableOrderedReturnin interfaceNaturalIdMultiLoadAccess<T>- Parameters:
enabled-true(the default) enables ordering;falsedisables it.- Returns:
this, for method chaining
-
multiLoad
public List<T> multiLoad(Object... ids)
Description copied from interface:NaturalIdMultiLoadAccessPerform a load of multiple entities by natural-id.See
NaturalIdMultiLoadAccess.enableOrderedReturn(boolean)andNaturalIdMultiLoadAccess.enableReturnOfDeletedEntities(boolean)for options which effect the size and "shape" of the return list.- Specified by:
multiLoadin interfaceNaturalIdMultiLoadAccess<T>- Parameters:
ids- The natural-id values to load- Returns:
- The managed entities.
-
multiLoad
public List<T> multiLoad(List<?> ids)
Description copied from interface:NaturalIdMultiLoadAccessPerform a load of multiple entities by natural-id.See
NaturalIdMultiLoadAccess.enableOrderedReturn(boolean)andNaturalIdMultiLoadAccess.enableReturnOfDeletedEntities(boolean)for options which effect the size and "shape" of the return list.- Specified by:
multiLoadin interfaceNaturalIdMultiLoadAccess<T>- Parameters:
ids- The natural-id values to load- Returns:
- The managed entities.
-
isReturnOfDeletedEntitiesEnabled
public boolean isReturnOfDeletedEntitiesEnabled()
Description copied from interface:MultiLoadOptionsShould we returned entities that are scheduled for deletion.- Specified by:
isReturnOfDeletedEntitiesEnabledin interfaceMultiLoadOptions- Returns:
- entities that are scheduled for deletion are returned as well.
-
isOrderReturnEnabled
public boolean isOrderReturnEnabled()
Description copied from interface:MultiLoadOptionsShould the entities be returned in the same order as their associated entity identifiers were provided.- Specified by:
isOrderReturnEnabledin interfaceMultiLoadOptions- Returns:
- entities follow the provided identifier order
-
getLockOptions
public LockOptions getLockOptions()
Description copied from interface:MultiLoadOptionsSpecify the lock options applied during loading.- Specified by:
getLockOptionsin interfaceMultiLoadOptions- Returns:
- lock options applied during loading.
-
getBatchSize
public Integer getBatchSize()
Description copied from interface:MultiLoadOptionsBatch size to use when loading entities from the database.- Specified by:
getBatchSizein interfaceMultiLoadOptions- Returns:
- JDBC batch size
-
-