@NaturalId. If an
entity has multiple attributes annotated @NaturalId, then
NaturalIdLoadAccess should be used instead.
Book book = session.bySimpleNaturalId(Book.class).load(isbn);
Session#bySimpleNaturalId(Class), org.hibernate.annotations.NaturalId , NaturalIdLoadAccess
| Modifier and Type | Method and Description |
|---|---|
| public SimpleNaturalIdLoadAccess | disableFetchProfile(String profileName)
Customize the associations fetched by specifying a fetch profile that should be disabled during this operation. |
| public SimpleNaturalIdLoadAccess | 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 proxy, if an instance exists. Otherwise,null.The value of the natural id naturalIdValue)Return the persistent instance with the given natural id value, assuming that the instance exists. |
| public T | |
| public Optional | Returns: The persistent instance, if any, as anOptionalThe identifier naturalIdValue) |
| public SimpleNaturalIdLoadAccess | Returns: this, for method chainingShould synchronization be performed?
enabled)true indicates synchronization will be performed;
false indicates it will be circumvented.For entities with mutable natural ids, should Hibernate perform "synchronization" prior to performing lookups? |
| public SimpleNaturalIdLoadAccess | Returns: this, for method chainingThe lock options to use lockOptions)Specify the lock options to use when querying the database. |
| public SimpleNaturalIdLoadAccess | with(RootGraph<T> graph, GraphSemantic semantic)
Customize the associations fetched by specifying an entity graph, and how it should be interpreted. |
| public default SimpleNaturalIdLoadAccess | 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 SimpleNaturalIdLoadAccess | 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 SimpleNaturalIdLoadAccess 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 SimpleNaturalIdLoadAccess 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(Object naturalIdValue) Return the persistent instance with the given natural id value, assuming that the instance exists. This method might return a proxied instance that is initialized on-demand, when a non-identifier method is accessed.
You should not use this method to determine if an instance exists;
to check for existence, use
| |
| load | back to summary |
|---|---|
| public T load(Object naturalIdValue) Return the persistent instance with the given natural id value,
or
| |
| loadOptional | back to summary |
|---|---|
| public Optional | |
| setSynchronizationEnabled | back to summary |
|---|---|
| public SimpleNaturalIdLoadAccess For entities with mutable natural ids, should Hibernate perform "synchronization" prior to performing lookups? The default is to perform "synchronization" (for correctness).
See
| |
| with | back to summary |
|---|---|
| public SimpleNaturalIdLoadAccess Specify the lock options to use when querying the database.
| |
| with | back to summary |
|---|---|
| public SimpleNaturalIdLoadAccess Customize the associations fetched by specifying an entity graph, and how it should be interpreted. | |
| withFetchGraph | back to summary |
|---|---|
| public default SimpleNaturalIdLoadAccess 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 SimpleNaturalIdLoadAccess Augment the associations fetched by default by specifying a list of additional associations to be fetched as an entity graph. | |