Top Description Methods
org.hibernate

public Interface MultiIdentifierLoadAccess<T>

Known Direct Implementers
org.hibernate.internal.SessionImpl.MultiIdentifierLoadAccessImpl
Imports
java.io.Serializable, java.util.List, org.hibernate.graph.GraphSemantic, .RootGraph

Loads multiple entities at once by identifiers, ultimately via one of the multiLoad methods, using the various options specified (if any)
Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public MultiIdentifierLoadAccess<T>

Returns:

this, for method chaining
enableOrderedReturn
(boolean
true (the default) enables ordering; false disables it.
enabled
)

Should the return List be ordered and positional in relation to the incoming ids?

public MultiIdentifierLoadAccess<T>

Returns:

this, for method chaining
enableReturnOfDeletedEntities
(boolean
true enables returning the deleted entities; false (the default) disables it.
enabled
)

Should the multi-load operation be allowed to return entities that are locally deleted?

public MultiIdentifierLoadAccess<T>

Returns:

this, for method chaining
enableSessionCheck
(boolean
true enables this checking; false (the default) disables it.
enabled
)

Specify whether we should check the Session to see whether the first-level cache already contains any of the entities to be loaded in a managed state for the purpose of not including those ids to the batch-load SQL.

public <
The identifier type
K extends Serializable
>
List<T>

Returns:

The persistent entities.
multiLoad
(K...
The ids to load
ids
)

Perform a load of multiple entities by identifiers.

public <
The identifier type
K extends Serializable
>
List<T>

Returns:

The persistent entities.
multiLoad
(List<K>
The ids to load
ids
)

Perform a load of multiple entities by identifiers.

public MultiIdentifierLoadAccess<T>

Returns:

this, for method chaining
with
(LockOptions
The lock options to use.
lockOptions
)

Specify the LockOptions to use when retrieving the entity.

public MultiIdentifierLoadAccess<T>

Returns:

this, for method chaining
with
(CacheMode
The CacheMode to use.
cacheMode
)

Specify the CacheMode to use when retrieving the entity.

public default MultiIdentifierLoadAccess<T>
with(RootGraph<T> graph)

public MultiIdentifierLoadAccess<T>
with(RootGraph<T> graph, GraphSemantic semantic)

public MultiIdentifierLoadAccess<T>

Returns:

this, for method chaining
withBatchSize
(int
The batch size
batchSize
)

Specify a batch size for loading the entities (how many at a time).

Method Detail

enableOrderedReturnback to summary
public MultiIdentifierLoadAccess<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. In other words, a request to multiLoad([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.

Parameters
enabled:boolean

true (the default) enables ordering; false disables it.

Returns:MultiIdentifierLoadAccess<T>

this, for method chaining

enableReturnOfDeletedEntitiesback to summary
public MultiIdentifierLoadAccess<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's Session#delete / Session#remove method, but not yet flushed. The default behavior is to handle them as null in the return (see enableOrderedReturn).

Parameters
enabled:boolean

true enables returning the deleted entities; false (the default) disables it.

Returns:MultiIdentifierLoadAccess<T>

this, for method chaining

enableSessionCheckback to summary
public MultiIdentifierLoadAccess<T> enableSessionCheck(boolean enabled)

Specify whether we should check the Session to see whether the first-level cache already contains any of the entities to be loaded in a managed state for the purpose of not including those ids to the batch-load SQL.

Parameters
enabled:boolean

true enables this checking; false (the default) disables it.

Returns:MultiIdentifierLoadAccess<T>

this, for method chaining

multiLoadback to summary
public <K extends Serializable> List<T> multiLoad(K... ids)

Perform a load of multiple entities by identifiers. See enableOrderedReturn and enableReturnOfDeletedEntities for options which effect the size and "shape" of the return list.

Parameters
<K>
The identifier type
ids:K[]

The ids to load

Returns:List<T>

The persistent entities.

multiLoadback to summary
public <K extends Serializable> List<T> multiLoad(List<K> ids)

Perform a load of multiple entities by identifiers. See enableOrderedReturn and enableReturnOfDeletedEntities for options which effect the size and "shape" of the return list.

Parameters
<K>
The identifier type
ids:List<K>

The ids to load

Returns:List<T>

The persistent entities.

withback to summary
public MultiIdentifierLoadAccess<T> with(LockOptions lockOptions)

Specify the LockOptions to use when retrieving the entity.

Parameters
lockOptions:LockOptions

The lock options to use.

Returns:MultiIdentifierLoadAccess<T>

this, for method chaining

withback to summary
public MultiIdentifierLoadAccess<T> with(CacheMode cacheMode)

Specify the CacheMode to use when retrieving the entity.

Parameters
cacheMode:CacheMode

The CacheMode to use.

Returns:MultiIdentifierLoadAccess<T>

this, for method chaining

withback to summary
public default MultiIdentifierLoadAccess<T> with(RootGraph<T> graph)
withback to summary
public MultiIdentifierLoadAccess<T> with(RootGraph<T> graph, GraphSemantic semantic)
withBatchSizeback to summary
public MultiIdentifierLoadAccess<T> withBatchSize(int batchSize)

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 of the underlying database.

Note that overall a batch-size is considered a hint. How the underlying loading mechanism interprets that is completely up to that underlying loading mechanism.

Parameters
batchSize:int

The batch size

Returns:MultiIdentifierLoadAccess<T>

this, for method chaining