Class EntityInitializerImpl
- java.lang.Object
-
- org.hibernate.sql.results.graph.internal.AbstractInitializer<EntityInitializerImpl.EntityInitializerData>
-
- org.hibernate.sql.results.graph.entity.internal.EntityInitializerImpl
-
- All Implemented Interfaces:
EntityInitializer<EntityInitializerImpl.EntityInitializerData>
,Initializer<EntityInitializerImpl.EntityInitializerData>
,InitializerParent<EntityInitializerImpl.EntityInitializerData>
public class EntityInitializerImpl extends AbstractInitializer<EntityInitializerImpl.EntityInitializerData> implements EntityInitializer<EntityInitializerImpl.EntityInitializerData>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EntityInitializerImpl.EntityInitializerData
-
Nested classes/interfaces inherited from interface org.hibernate.sql.results.graph.Initializer
Initializer.State
-
-
Field Summary
-
Fields inherited from class org.hibernate.sql.results.graph.internal.AbstractInitializer
initializerId
-
Fields inherited from interface org.hibernate.sql.results.graph.Initializer
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description EntityInitializerImpl(EntityResultGraphNode resultDescriptor, String sourceAlias, @Nullable Fetch identifierFetch, @Nullable Fetch discriminatorFetch, @Nullable DomainResult<?> keyResult, @Nullable DomainResult<Object> rowIdResult, NotFoundAction notFoundAction, boolean affectedByFilter, @Nullable InitializerParent<?> parent, boolean isResultInitializer, AssemblerCreationState creationState)
-
Method Summary
-
Methods inherited from class org.hibernate.sql.results.graph.internal.AbstractInitializer
finishUpRow, getData, startLoading
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.sql.results.graph.entity.EntityInitializer
asEntityInitializer, getConcreteDescriptor, getEntityIdentifier, getTargetInstance, isEntityInitializer
-
Methods inherited from interface org.hibernate.sql.results.graph.Initializer
asCollectionInitializer, asEmbeddableInitializer, endLoading, endLoading, findOwningEntityInitializer, finishUpRow, finishUpRow, getData, getResolvedInstance, getResolvedInstance, initializeInstance, initializeInstanceFromParent, isCollectionInitializer, isEmbeddableInitializer, isLazyCapable, resolveFromPreviousRow, resolveInstance, resolveInstance, resolveKey, resolveState, startLoading
-
-
-
-
Constructor Detail
-
EntityInitializerImpl
public EntityInitializerImpl(EntityResultGraphNode resultDescriptor, String sourceAlias, @Nullable Fetch identifierFetch, @Nullable Fetch discriminatorFetch, @Nullable DomainResult<?> keyResult, @Nullable DomainResult<Object> rowIdResult, NotFoundAction notFoundAction, boolean affectedByFilter, @Nullable InitializerParent<?> parent, boolean isResultInitializer, AssemblerCreationState creationState)
-
-
Method Detail
-
createInitializerData
protected EntityInitializerImpl.EntityInitializerData createInitializerData(RowProcessingState rowProcessingState)
- Specified by:
createInitializerData
in classAbstractInitializer<EntityInitializerImpl.EntityInitializerData>
-
resolveKey
public void resolveKey(EntityInitializerImpl.EntityInitializerData data)
Description copied from interface:Initializer
Step 1.1 - Resolve the key value for this initializer for the current row and then recurse to the sub-initializers. After this point, the initializer knows whether further processing is necessary for the current row i.e. if the object is missing.- Specified by:
resolveKey
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
- Overrides:
resolveKey
in classAbstractInitializer<EntityInitializerImpl.EntityInitializerData>
-
getEntityIdentifier
public @Nullable Object getEntityIdentifier(EntityInitializerImpl.EntityInitializerData data)
- Specified by:
getEntityIdentifier
in interfaceEntityInitializer<EntityInitializerImpl.EntityInitializerData>
-
resolveEntityKeyOnly
public @Nullable EntityKey resolveEntityKeyOnly(RowProcessingState rowProcessingState)
- Specified by:
resolveEntityKeyOnly
in interfaceEntityInitializer<EntityInitializerImpl.EntityInitializerData>
-
resetResolvedEntityRegistrations
public void resetResolvedEntityRegistrations(RowProcessingState rowProcessingState)
Description copied from interface:EntityInitializer
Resets the resolved entity registrations by i.e. removingEntityHolder
.
-
resolveKey
protected void resolveKey(EntityInitializerImpl.EntityInitializerData data, boolean entityKeyOnly)
-
resolveInstanceSubInitializers
protected void resolveInstanceSubInitializers(EntityInitializerImpl.EntityInitializerData data)
-
resolveKeySubInitializers
protected void resolveKeySubInitializers(EntityInitializerImpl.EntityInitializerData data)
-
resolveEntityKey
@EnsuresNonNull("data.entityKey") protected void resolveEntityKey(EntityInitializerImpl.EntityInitializerData data, Object id)
-
setMissing
protected void setMissing(EntityInitializerImpl.EntityInitializerData data)
-
resolveFromPreviousRow
public void resolveFromPreviousRow(EntityInitializerImpl.EntityInitializerData data)
Description copied from interface:Initializer
Step 1.2 - Special variant ofInitializer.resolveKey(InitializerData)
that allows the reuse of key value and instance value from the previous row.- Specified by:
resolveFromPreviousRow
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
-
initializeInstanceFromParent
public void initializeInstanceFromParent(Object parentInstance, EntityInitializerImpl.EntityInitializerData data)
Description copied from interface:Initializer
Step 3.1 - Initialize the state of the instance as extracted from the given parentInstance. Extraction can be done with theInitializer.getInitializedPart()
. Initializers are supposed to recursively call this method for sub-initializers. This alternative initialization protocol is used for shallow query cache hits, in which case there is no data available in theJdbcValuesCacheHit
to initialize potentially lazy associations.- Specified by:
initializeInstanceFromParent
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
-
isResultInitializer
public boolean isResultInitializer()
Description copied from interface:Initializer
Indicates if this is a result or fetch initializer.- Specified by:
isResultInitializer
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
-
getInitializedPart
public ModelPart getInitializedPart()
- Specified by:
getInitializedPart
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
-
getNavigablePath
public NavigablePath getNavigablePath()
- Specified by:
getNavigablePath
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
-
getIdentifierAssembler
protected DomainResultAssembler<?> getIdentifierAssembler()
-
getEntityDescriptor
public EntityPersister getEntityDescriptor()
Description copied from interface:EntityInitializer
Get the descriptor for the type of entity being initialized- Specified by:
getEntityDescriptor
in interfaceEntityInitializer<EntityInitializerImpl.EntityInitializerData>
-
getTargetInstance
public Object getTargetInstance(EntityInitializerImpl.EntityInitializerData data)
Description copied from interface:EntityInitializer
Get the target entity instance for the currently processing "row".- Specified by:
getTargetInstance
in interfaceEntityInitializer<EntityInitializerImpl.EntityInitializerData>
-
getParent
public @Nullable InitializerParent<?> getParent()
Description copied from interface:Initializer
Returns the parentInitializer
ornull
if this is a result initializer.- Specified by:
getParent
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
-
initializeAttributeType
protected void initializeAttributeType(Type[] attributeTypes, EntityPersister entityDescriptor, String attributeName)
-
determineConcreteEntityDescriptor
public static @Nullable EntityPersister determineConcreteEntityDescriptor(RowProcessingState rowProcessingState, @Nullable BasicResultAssembler<?> discriminatorAssembler, EntityPersister entityDescriptor) throws WrongClassException
- Throws:
WrongClassException
-
useEmbeddedIdentifierInstanceAsEntity
protected boolean useEmbeddedIdentifierInstanceAsEntity(EntityInitializerImpl.EntityInitializerData data)
-
resolveInstance
public void resolveInstance(Object instance, EntityInitializerImpl.EntityInitializerData data)
Description copied from interface:Initializer
Step 2.2 - Use the given instance as resolved instance for this initializer. Initializers are supposed to recursively call this method for sub-initializers. This alternative initialization protocol is used when a parent instance was already part of the persistence context.- Specified by:
resolveInstance
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
-
resolveInstance
public void resolveInstance(EntityInitializerImpl.EntityInitializerData data)
Description copied from interface:Initializer
Step 2.1 - Using the key resolved inInitializer.resolveKey(Data)
, resolve the instance (of the thing initialized) to use for the current row. After this point, the initializer knows the entity/collection/component instance for the current row based on the resolved key. If the resolving was successful,Initializer.getResolvedInstance(RowProcessingState)
will return that instance.- Specified by:
resolveInstance
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
-
resolveEntityInstance1
protected void resolveEntityInstance1(EntityInitializerImpl.EntityInitializerData data)
-
getEntityFromExecutionContext
protected Object getEntityFromExecutionContext(EntityInitializerImpl.EntityInitializerData data)
-
upgradeLockMode
protected void upgradeLockMode(EntityInitializerImpl.EntityInitializerData data)
-
resolveEntityInstance2
protected Object resolveEntityInstance2(EntityInitializerImpl.EntityInitializerData data)
Used by Hibernate Reactive
-
resolveEntityInstance
protected Object resolveEntityInstance(EntityInitializerImpl.EntityInitializerData data)
-
instantiateEntity
protected Object instantiateEntity(EntityInitializerImpl.EntityInitializerData data)
-
registerLoadingEntity
protected void registerLoadingEntity(EntityInitializerImpl.EntityInitializerData data, Object instance)
-
registerReloadedEntity
protected void registerReloadedEntity(EntityInitializerImpl.EntityInitializerData data)
-
initializeInstance
public void initializeInstance(EntityInitializerImpl.EntityInitializerData data)
Description copied from interface:Initializer
Step 3 - Initialize the state of the instance resolved inInitializer.resolveInstance(Data)
from the current row values. All resolved state for the current row is injected into the resolved instance- Specified by:
initializeInstance
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
- Overrides:
initializeInstance
in classAbstractInitializer<EntityInitializerImpl.EntityInitializerData>
-
consistentInstance
protected boolean consistentInstance(EntityInitializerImpl.EntityInitializerData data)
-
initializeEntityInstance
protected void initializeEntityInstance(EntityInitializerImpl.EntityInitializerData data)
-
updateCaches
protected void updateCaches(EntityInitializerImpl.EntityInitializerData data, SharedSessionContractImplementor session, PersistenceContext persistenceContext, Object[] resolvedEntityState, Object version)
-
registerNaturalIdResolution
protected void registerNaturalIdResolution(EntityInitializerImpl.EntityInitializerData data, PersistenceContext persistenceContext, Object[] resolvedEntityState)
-
takeSnapshot
protected void takeSnapshot(EntityInitializerImpl.EntityInitializerData data, SharedSessionContractImplementor session, PersistenceContext persistenceContext, EntityEntry entityEntry, Object[] resolvedEntityState)
-
registerPossibleUniqueKeyEntries
protected void registerPossibleUniqueKeyEntries(EntityInitializerImpl.EntityInitializerData data, Object[] resolvedEntityState, SharedSessionContractImplementor session)
-
extractConcreteTypeStateValues
protected Object[] extractConcreteTypeStateValues(EntityInitializerImpl.EntityInitializerData data)
-
resolveState
public void resolveState(EntityInitializerImpl.EntityInitializerData data)
- Specified by:
resolveState
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
-
resolveEntityState
protected void resolveEntityState(EntityInitializerImpl.EntityInitializerData data)
-
skipInitialization
protected boolean skipInitialization(EntityInitializerImpl.EntityInitializerData data)
-
preLoad
protected void preLoad(EntityInitializerImpl.EntityInitializerData data, Object[] resolvedEntityState)
-
isPartOfKey
public boolean isPartOfKey()
Description copied from interface:Initializer
Indicates whether this initializer is part of a key i.e. entity identifier, foreign key or collection key.- Specified by:
isPartOfKey
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
-
isEager
public boolean isEager()
Description copied from interface:Initializer
Indicates whether calling resolve is needed when the object for this initializer is initialized already.- Specified by:
isEager
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
-
hasLazySubInitializers
public boolean hasLazySubInitializers()
Description copied from interface:Initializer
Indicates whether this initializer has sub-initializers which are lazy.- Specified by:
hasLazySubInitializers
in interfaceInitializer<EntityInitializerImpl.EntityInitializerData>
-
isPreviousRowReuse
public boolean isPreviousRowReuse()
-
getConcreteDescriptor
public EntityPersister getConcreteDescriptor(EntityInitializerImpl.EntityInitializerData data)
- Specified by:
getConcreteDescriptor
in interfaceEntityInitializer<EntityInitializerImpl.EntityInitializerData>
-
initializeSubInstancesFromParent
protected void initializeSubInstancesFromParent(EntityInitializerImpl.EntityInitializerData data)
-
forEachSubInitializer
protected void forEachSubInitializer(BiConsumer<Initializer<?>,RowProcessingState> consumer, InitializerData data)
- Specified by:
forEachSubInitializer
in classAbstractInitializer<EntityInitializerImpl.EntityInitializerData>
-
getAttributeInterceptor
public static PersistentAttributeInterceptor getAttributeInterceptor(Object entity)
-
getVersionAssembler
protected @Nullable DomainResultAssembler<?> getVersionAssembler()
-
getRowIdAssembler
protected @Nullable DomainResultAssembler<Object> getRowIdAssembler()
-
getAssemblers
protected @Nullable DomainResultAssembler<?>[][] getAssemblers()
-
getDiscriminatorAssembler
protected @Nullable BasicResultAssembler<?> getDiscriminatorAssembler()
-
isKeyManyToOne
protected boolean isKeyManyToOne()
-
getSubInitializers
protected Initializer<?>[][] getSubInitializers()
-
getKeyAssembler
public @Nullable DomainResultAssembler<?> getKeyAssembler()
-
-