Top Description Fields Constructors Methods
org.hibernate.loader.internal

public Class IdentifierLoadAccessImpl<T>

extends Object
implements IdentifierLoadAccess<T>, CoercionContext
Class Inheritance
All Implemented Interfaces
org.hibernate.type.descriptor.java.JavaType.CoercionContext, org.hibernate.IdentifierLoadAccess
Imports
java.util.HashSet, .Optional, .Set, java.util.function.Supplier, org.hibernate.CacheMode, .IdentifierLoadAccess, .LockOptions, .ObjectNotFoundException, .UnknownProfileException, org.hibernate.bytecode.enhance.spi.interceptor.BytecodeLazyAttributeInterceptor, .EnhancementAsProxyLazinessInterceptor, org.hibernate.bytecode.spi.BytecodeEnhancementMetadata, org.hibernate.engine.spi.EffectiveEntityGraph, .LoadQueryInfluencers, .SessionFactoryImplementor, .SessionImplementor, org.hibernate.event.spi.EventSource, .LoadEvent, .LoadEventListener, org.hibernate.graph.GraphSemantic, .RootGraph, org.hibernate.graph.spi.RootGraphImplementor, org.hibernate.persister.entity.EntityPersister, org.hibernate.proxy.LazyInitializer, org.hibernate.type.descriptor.java.JavaType, org.hibernate.type.spi.TypeConfiguration

Standard implementation of load-by-id
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private CacheMode
private final LoadAccessContext
private Set<String>
private Set<String>
private final EntityPersister
private GraphSemantic
private LockOptions
private Boolean
private RootGraphImplementor<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private Object
coerceId(Object id, SessionFactoryImplementor factory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
public IdentifierLoadAccess<T>
disableFetchProfile(String profileName)

Implements org.hibernate.IdentifierLoadAccess.disableFetchProfile.

Customize the associations fetched by specifying a fetch profile that should be disabled during this operation.
protected T
protected final T
public IdentifierLoadAccess<T>
enableFetchProfile(String profileName)

Implements org.hibernate.IdentifierLoadAccess.enableFetchProfile.

Customize the associations fetched by specifying a fetch profile that should be enabled during this operation.
public final T
getReference(Object
The identifier for which to obtain a reference
id
)

Implements org.hibernate.IdentifierLoadAccess.getReference.

Return the persistent instance with the given identifier, assuming that the instance exists.
private Object
getReference(Object id, EventSource eventSource, SessionFactoryImplementor factory, String entityName, Boolean readOnly)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
public TypeConfiguration
private void
private static boolean
isLoadByIdComplianceEnabled(SessionFactoryImplementor factory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
private Boolean
public final T
load(Object
The identifier
id
)

Implements org.hibernate.IdentifierLoadAccess.load.

Return the persistent instance with the given identifier, or null if there is no such persistent instance.
private Object
load(Object id, EventSource eventSource, String entityName, Boolean readOnly)

public Optional<T>
loadOptional(Object
The identifier
id
)

Implements org.hibernate.IdentifierLoadAccess.loadOptional.

Just like load, except that here an Optional is returned.
protected T
perform(Supplier<T> executor)

public final IdentifierLoadAccessImpl<T>
with(LockOptions
The lock options to use
lockOptions
)

Implements org.hibernate.IdentifierLoadAccess.with.

Specify the lock options to use when querying the database.
public IdentifierLoadAccess<T>
with(CacheMode
The CacheMode to use
cacheMode
)

Implements org.hibernate.IdentifierLoadAccess.with.

Specify the CacheMode to use when obtaining an entity.
public IdentifierLoadAccess<T>
with(RootGraph<T> graph, GraphSemantic semantic)

Implements org.hibernate.IdentifierLoadAccess.with.

Customize the associations fetched by specifying an entity graph, and how it should be interpreted.
public IdentifierLoadAccess<T>
withReadOnly(boolean readOnly)

Implements org.hibernate.IdentifierLoadAccess.withReadOnly.

Specify whether the entity should be loaded in read-only mode.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheModeback to summary
private CacheMode cacheMode
contextback to summary
private final LoadAccessContext context
disabledFetchProfilesback to summary
private Set<String> disabledFetchProfiles
enabledFetchProfilesback to summary
private Set<String> enabledFetchProfiles
entityPersisterback to summary
private final EntityPersister entityPersister
graphSemanticback to summary
private GraphSemantic graphSemantic
lockOptionsback to summary
private LockOptions lockOptions
readOnlyback to summary
private Boolean readOnly
rootGraphback to summary
private RootGraphImplementor<T> rootGraph

Constructor Detail

IdentifierLoadAccessImplback to summary
public IdentifierLoadAccessImpl(LoadAccessContext context, EntityPersister entityPersister)

Method Detail

coerceIdback to summary
private Object coerceId(Object id, SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

disableFetchProfileback to summary
public IdentifierLoadAccess<T> disableFetchProfile(String profileName)

Implements org.hibernate.IdentifierLoadAccess.disableFetchProfile.

Doc from org.hibernate.IdentifierLoadAccess.disableFetchProfile.

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.

Annotations
@Override
doGetReferenceback to summary
protected T doGetReference(Object id)
Annotations
@SuppressWarnings:unchecked
doLoadback to summary
protected final T doLoad(Object id)
Annotations
@SuppressWarnings:unchecked
enableFetchProfileback to summary
public IdentifierLoadAccess<T> enableFetchProfile(String profileName)

Implements org.hibernate.IdentifierLoadAccess.enableFetchProfile.

Doc from org.hibernate.IdentifierLoadAccess.enableFetchProfile.

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.

Annotations
@Override
getReferenceback to summary
public final T getReference(Object id)

Implements org.hibernate.IdentifierLoadAccess.getReference.

Doc from org.hibernate.IdentifierLoadAccess.getReference.

Return the persistent instance with the given identifier, 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 instead. Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.

Parameters
id:Object

The identifier for which to obtain a reference

Returns:T

the persistent instance or proxy

Annotations
@Override
getReferenceback to summary
private Object getReference(Object id, EventSource eventSource, SessionFactoryImplementor factory, String entityName, Boolean readOnly)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

getTypeConfigurationback to summary
public TypeConfiguration getTypeConfiguration()

Implements org.hibernate.type.descriptor.java.JavaType.CoercionContext.getTypeConfiguration.

Annotations
@Override
initializeIfNecessaryback to summary
private void initializeIfNecessary(Object result)
isLoadByIdComplianceEnabledback to summary
private static boolean isLoadByIdComplianceEnabled(SessionFactoryImplementor factory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

isReadOnlyback to summary
private Boolean isReadOnly(SessionImplementor session)
loadback to summary
public final T load(Object id)

Implements org.hibernate.IdentifierLoadAccess.load.

Doc from org.hibernate.IdentifierLoadAccess.load.

Return the persistent instance with the given identifier, or null if there is no such persistent instance. If the instance is already associated with the session, return that instance, initializing it if needed. This method never returns an uninitialized instance.

Parameters
id:Object

The identifier

Returns:T

The persistent instance or null

Annotations
@Override
loadback to summary
private Object load(Object id, EventSource eventSource, String entityName, Boolean readOnly)
loadOptionalback to summary
public Optional<T> loadOptional(Object id)

Implements org.hibernate.IdentifierLoadAccess.loadOptional.

Doc from org.hibernate.IdentifierLoadAccess.loadOptional.

Just like load, except that here an Optional is returned.

Parameters
id:Object

The identifier

Returns:Optional<T>

The persistent instance, if any, as an Optional

Annotations
@Override
performback to summary
protected T perform(Supplier<T> executor)
withback to summary
public final IdentifierLoadAccessImpl<T> with(LockOptions lockOptions)

Implements org.hibernate.IdentifierLoadAccess.with.

Doc from org.hibernate.IdentifierLoadAccess.with.

Specify the lock options to use when querying the database.

Parameters
lockOptions:LockOptions

The lock options to use

Returns:IdentifierLoadAccessImpl<T>

this, for method chaining

Annotations
@Override
withback to summary
public IdentifierLoadAccess<T> with(CacheMode cacheMode)

Implements org.hibernate.IdentifierLoadAccess.with.

Doc from org.hibernate.IdentifierLoadAccess.with.

Specify the CacheMode to use when obtaining an entity.

Parameters
cacheMode:CacheMode

The CacheMode to use

Returns:IdentifierLoadAccess<T>

this, for method chaining

Annotations
@Override
withback to summary
public IdentifierLoadAccess<T> with(RootGraph<T> graph, GraphSemantic semantic)

Implements org.hibernate.IdentifierLoadAccess.with.

Doc from org.hibernate.IdentifierLoadAccess.with.

Customize the associations fetched by specifying an entity graph, and how it should be interpreted.

Annotations
@Override
withReadOnlyback to summary
public IdentifierLoadAccess<T> withReadOnly(boolean readOnly)

Implements org.hibernate.IdentifierLoadAccess.withReadOnly.

Doc from org.hibernate.IdentifierLoadAccess.withReadOnly.

Specify whether the entity should be loaded in read-only mode.

Annotations
@Override