Package org.hibernate.internal
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.Integer
getBatchSize()
Batch size to use when loading entities from the database.LockOptions
getLockOptions()
Specify the lock options applied during loading.boolean
isOrderReturnEnabled()
Should the entities be returned in the same order as their associated entity identifiers were provided.boolean
isReturnOfDeletedEntitiesEnabled()
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 theCacheMode
to 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 theLockOptions
to 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:NaturalIdMultiLoadAccess
Specify theLockOptions
to use when retrieving the entity.- Specified by:
with
in 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:NaturalIdMultiLoadAccess
Specify theCacheMode
to use when retrieving the entity.- Specified by:
with
in 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:NaturalIdMultiLoadAccess
Define a load or fetch graph to be used when retrieving the entity- Specified by:
with
in interfaceNaturalIdMultiLoadAccess<T>
-
withBatchSize
public NaturalIdMultiLoadAccess<T> withBatchSize(int batchSize)
Description copied from interface:NaturalIdMultiLoadAccess
Specify 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:
withBatchSize
in interfaceNaturalIdMultiLoadAccess<T>
- Parameters:
batchSize
- The batch size- Returns:
this
, for method chaining
-
enableReturnOfDeletedEntities
public NaturalIdMultiLoadAccess<T> enableReturnOfDeletedEntities(boolean enabled)
Description copied from interface:NaturalIdMultiLoadAccess
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. The default behavior is to handle them as null in the return (seeNaturalIdMultiLoadAccess.enableOrderedReturn(boolean)
).- Specified by:
enableReturnOfDeletedEntities
in interfaceNaturalIdMultiLoadAccess<T>
- Parameters:
enabled
-true
enables 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:NaturalIdMultiLoadAccess
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. 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:
enableOrderedReturn
in interfaceNaturalIdMultiLoadAccess<T>
- Parameters:
enabled
-true
(the default) enables ordering;false
disables it.- Returns:
this
, for method chaining
-
multiLoad
public List<T> multiLoad(Object... ids)
Description copied from interface:NaturalIdMultiLoadAccess
Perform a load of multiple entities by natural-id. SeeNaturalIdMultiLoadAccess.enableOrderedReturn(boolean)
andNaturalIdMultiLoadAccess.enableReturnOfDeletedEntities(boolean)
for options which effect the size and "shape" of the return list.- Specified by:
multiLoad
in 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:NaturalIdMultiLoadAccess
Perform a load of multiple entities by natural-id. SeeNaturalIdMultiLoadAccess.enableOrderedReturn(boolean)
andNaturalIdMultiLoadAccess.enableReturnOfDeletedEntities(boolean)
for options which effect the size and "shape" of the return list.- Specified by:
multiLoad
in interfaceNaturalIdMultiLoadAccess<T>
- Parameters:
ids
- The natural-id values to load- Returns:
- The managed entities.
-
isReturnOfDeletedEntitiesEnabled
public boolean isReturnOfDeletedEntitiesEnabled()
Description copied from interface:MultiLoadOptions
Should we returned entities that are scheduled for deletion.- Specified by:
isReturnOfDeletedEntitiesEnabled
in interfaceMultiLoadOptions
- Returns:
- entities that are scheduled for deletion are returned as well.
-
isOrderReturnEnabled
public boolean isOrderReturnEnabled()
Description copied from interface:MultiLoadOptions
Should the entities be returned in the same order as their associated entity identifiers were provided.- Specified by:
isOrderReturnEnabled
in interfaceMultiLoadOptions
- Returns:
- entities follow the provided identifier order
-
getLockOptions
public LockOptions getLockOptions()
Description copied from interface:MultiLoadOptions
Specify the lock options applied during loading.- Specified by:
getLockOptions
in interfaceMultiLoadOptions
- Returns:
- lock options applied during loading.
-
getBatchSize
public Integer getBatchSize()
Description copied from interface:MultiLoadOptions
Batch size to use when loading entities from the database.- Specified by:
getBatchSize
in interfaceMultiLoadOptions
- Returns:
- JDBC batch size
-
-