@NaturalId,
then SimpleNaturalIdLoadAccess may be used instead.
Book book =
session.byNaturalId(Book.class)
.using(Book_.isbn, isbn)
.using(Book_.printing, printing)
.load();
Session#byNaturalId(Class), org.hibernate.annotations.NaturalId , SimpleNaturalIdLoadAccess
| Modifier and Type | Method and Description |
|---|---|
| public NaturalIdLoadAccess | disableFetchProfile(String profileName)
Customize the associations fetched by specifying a fetch profile that should be disabled during this operation. |
| public NaturalIdLoadAccess | enableFetchProfile(String profileName)
Customize the associations fetched by specifying a fetch profile that should be enabled during this operation. |
| public T | Returns: the persistent instance or proxyReturn the persistent instance with the full natural id specified
by previous calls to |
| public T | |
| public Optional | Returns: The persistent instance, if one, as anOptional |
| public NaturalIdLoadAccess | Returns: this, for method chainingShould synchronization be performed?
enabled)true indicates synchronization will be performed;
false indicates it will be circumvented.Determines if cached natural id cross-references are synchronized before query execution with unflushed modifications made in memory to mutable natural ids. |
| public <X> NaturalIdLoadAccess | Returns: this, for method chainingA typesafe reference to an attribute of the
entity that is annotated attribute, X @NaturalIdThe value of the attribute value)Add a |
| public NaturalIdLoadAccess | Returns: this, for method chainingThe name of an attribute of the entity
that is annotated attributeName, Object @NaturalIdThe value of the attribute value)Add a |
| public NaturalIdLoadAccess | Returns: this, for method chainingSet multiple |
| public NaturalIdLoadAccess | Returns: this, for method chaining
Deprecated
since 6.3. use
Set multiple using(Map) with Map#of, which is
slightly more typesafe
@NaturalId
attribute values at once.
|
| public NaturalIdLoadAccess | Returns: this, for method chainingThe lock options to use. lockOptions)Specify the lock options to use when querying the database. |
| public NaturalIdLoadAccess | with(RootGraph<T> graph, GraphSemantic semantic)
Customize the associations fetched by specifying an entity graph, and how it should be interpreted. |
| public default NaturalIdLoadAccess | 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 NaturalIdLoadAccess | withLoadGraph(RootGraph<T> graph)
Augment the associations fetched by default by specifying a list of additional associations to be fetched as an entity graph. |
| disableFetchProfile | back to summary |
|---|---|
| public NaturalIdLoadAccess Customize the associations fetched by specifying a fetch profile that should be disabled during this operation. This allows the session-level fetch profiles to be temporarily overridden.
| |
| enableFetchProfile | back to summary |
|---|---|
| public NaturalIdLoadAccess Customize the associations fetched by specifying a fetch profile that should be enabled during this operation. This allows the session-level fetch profiles to be temporarily overridden.
| |
| getReference | back to summary |
|---|---|
| public T getReference() Return the persistent instance with the full natural id specified
by previous calls to
You should not use this method to determine if an instance exists;
to check for existence, use
| |
| load | back to summary |
|---|---|
| public T load() Return the persistent instance with the full natural id specified
by previous calls to
| |
| loadOptional | back to summary |
|---|---|
| public Optional | |
| setSynchronizationEnabled | back to summary |
|---|---|
| public NaturalIdLoadAccess Determines if cached natural id cross-references are synchronized before query execution with unflushed modifications made in memory to mutable natural ids. By default, every cached cross-reference is updated to reflect any modification made in memory. Here "synchronization" means updating the natural id to primary key cross-reference maintained by the session. When enabled, before performing the lookup, Hibernate will check all entities associated with the session of the given type to determine if any natural id values have changed and, if so, update the cross-references. There's some cost associated with this synchronization, so if it's completely certain the no natural ids have been modified, synchronization may be safely disabled to avoid that cost. Disabling this setting when natural id values have been modified may lead to incorrect results.
| |
| using | back to summary |
|---|---|
| public <X> NaturalIdLoadAccess Add a
| |
| using | back to summary |
|---|---|
| public NaturalIdLoadAccess Add a
| |
| using | back to summary |
|---|---|
| public NaturalIdLoadAccess Set multiple
Book book =
session.byNaturalId(Book.class)
.using(Map.of(Book_.ISBN, isbn, Book_.PRINTING, printing))
.load();
| |
| using | back to summary |
|---|---|
| public NaturalIdLoadAccess Set multiple
Book book =
session.byNaturalId(Book.class)
.using(Book_.ISBN, isbn, Book_.PRINTING, printing)
.load();
| |
| with | back to summary |
|---|---|
| public NaturalIdLoadAccess Specify the lock options to use when querying the database.
| |
| with | back to summary |
|---|---|
| public NaturalIdLoadAccess Customize the associations fetched by specifying an entity graph, and how it should be interpreted. | |
| withFetchGraph | back to summary |
|---|---|
| public default NaturalIdLoadAccess 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 NaturalIdLoadAccess Augment the associations fetched by default by specifying a list of additional associations to be fetched as an entity graph. | |