List<Book> books =
session.byMultipleNaturalId(Book.class)
.withBatchSize(10)
.multiLoad(isbnList);
Composite natural ids may be accommodated by passing a list of
maps of type Map<String,Object> to multiLoad.
Each map must contain the natural id attribute values keyed by
@NaturalId attribute
name.
var compositeNaturalId =
Map.of(Book_.ISBN, isbn, Book_.PRINTING, printing);
Session#byMultipleNaturalId(Class), org.hibernate.annotations.NaturalId
| Modifier and Type | Method and Description |
|---|---|
| public static Map | compoundValue(Object... elements)
Deprecated
since 6.3. use
Helper for creating a Map#of instead
Map that represents the value of a
composite natural id. An even number of arguments is expected,
with each attribute name followed by its value.
|
| public NaturalIdMultiLoadAccess | Returns: this, for method chainingtrue if entity instances should be ordered;
false if they may be returned in any order.Should the returned list of entity instances be ordered, with the
position of an entity instance determined by the position of its
identifier in the list if ids passed to |
| public NaturalIdMultiLoadAccess | Returns: this, for method chainingtrue if removed entities should be returned;
false if they should be replaced by null values.Should |
| public List | |
| public List | |
| public NaturalIdMultiLoadAccess | Returns: this, for method chainingThe lock options to use lockOptions)Specify the lock options to use when querying the database. |
| public NaturalIdMultiLoadAccess | |
| public default NaturalIdMultiLoadAccess | |
| public NaturalIdMultiLoadAccess | with(RootGraph<T> graph, GraphSemantic semantic)
Customize the associations fetched by specifying an entity graph, and how it should be interpreted. |
| public NaturalIdMultiLoadAccess | Returns: this, for method chainingThe batch size batchSize)Specify a batch size, that is, how many entities should be fetched in each request to the database. |
| public default NaturalIdMultiLoadAccess | withFetchGraph(RootGraph<T> graph)
Override the associations fetched by default by specifying the complete list of associations to be fetched as an entity graph. |
| public default NaturalIdMultiLoadAccess | withLoadGraph(RootGraph<T> graph)
Augment the associations fetched by default by specifying a list of additional associations to be fetched as an entity graph. |
| compoundValue | back to summary |
|---|---|
| public static Map Helper for creating a
| |
| enableOrderedReturn | back to summary |
|---|---|
| public NaturalIdMultiLoadAccess Should the returned list of entity instances be ordered, with the
position of an entity instance determined by the position of its
identifier in the list if ids passed to By default, the returned list is ordered and the positions of the entities correspond to the positions of their ids. In this case, the handling of entities marked for removal becomes important.
| |
| enableReturnOfDeletedEntities | back to summary |
|---|---|
| public NaturalIdMultiLoadAccess Should
By default, instances marked for removal are replaced by null in
the returned list of entities when
| |
| multiLoad | back to summary |
|---|---|
| public List Retrieve the entities with the given natural id values.
Note that the options | |
| multiLoad | back to summary |
|---|---|
| public List Retrieve the entities with the given natural id values.
Note that the options | |
| with | back to summary |
|---|---|
| public NaturalIdMultiLoadAccess Specify the lock options to use when querying the database.
| |
| with | back to summary |
|---|---|
| public NaturalIdMultiLoadAccess Specify the
| |
| with | back to summary |
|---|---|
public default NaturalIdMultiLoadAccess
| |
| with | back to summary |
|---|---|
| public NaturalIdMultiLoadAccess Customize the associations fetched by specifying an entity graph, and how it should be interpreted. | |
| withBatchSize | back to summary |
|---|---|
| public NaturalIdMultiLoadAccess Specify a batch size, that is, how many entities should be fetched in each request to the database.
If an explicit batch size is set manually, care should be taken to not exceed the capabilities of the underlying database. A batch size is considered a hint.
| |
| withFetchGraph | back to summary |
|---|---|
| public default NaturalIdMultiLoadAccess Override the associations fetched by default by specifying the complete list of associations to be fetched as an entity graph. | |
| withLoadGraph | back to summary |
|---|---|
| public default NaturalIdMultiLoadAccess Augment the associations fetched by default by specifying a list of additional associations to be fetched as an entity graph. | |