Class AbstractEntityInitializer
- java.lang.Object
-
- org.hibernate.sql.results.graph.AbstractFetchParentAccess
-
- org.hibernate.sql.results.graph.entity.AbstractEntityInitializer
-
- All Implemented Interfaces:
EntityInitializer,FetchParentAccess,Initializer
- Direct Known Subclasses:
EntityJoinedFetchInitializer,EntityResultInitializer
public abstract class AbstractEntityInitializer extends AbstractFetchParentAccess implements EntityInitializer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractEntityInitializer.State
-
Field Summary
Fields Modifier and Type Field Description protected ObjectentityInstanceForNotifyprotected AbstractEntityInitializer.Statestate
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractEntityInitializer(EntityResultGraphNode resultDescriptor, NavigablePath navigablePath, LockMode lockMode, Fetch identifierFetch, Fetch discriminatorFetch, DomainResult<Object> rowIdResult, AssemblerCreationState creationState)Deprecated, for removal: This API element is subject to removal in a future version.protectedAbstractEntityInitializer(EntityResultGraphNode resultDescriptor, NavigablePath navigablePath, LockMode lockMode, Fetch identifierFetch, Fetch discriminatorFetch, DomainResult<Object> rowIdResult, FetchParentAccess parentAccess, AssemblerCreationState creationState)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleanconsistentInstance(Object toInitialize, RowProcessingState rowProcessingState)voidendLoading(ExecutionContext executionContext)Lifecycle method called at the very end of the result values processingprotected Object[]extractConcreteTypeStateValues(RowProcessingState rowProcessingState)voidfinishUpRow(RowProcessingState rowProcessingState)Lifecycle method called at the end of the current row processing.protected DomainResultAssembler<?>[][]getAssemblers()EntityPersistergetConcreteDescriptor()EntityPersistergetEntityDescriptor()Get the descriptor for the type of entity being initializedprotected ObjectgetEntityFromExecutionContext(RowProcessingState rowProcessingState)ObjectgetEntityInstance()Get the entity instance for the currently processing "row".protected ObjectgetEntityInstanceForNotify()EntityKeygetEntityKey()FetchParentAccessgetFetchParentAccess()protected DomainResultAssembler<?>getIdentifierAssembler()ModelPartgetInitializedPart()ObjectgetKeyValue()protected LockModegetLockMode()NavigablePathgetNavigablePath()@Nullable EntityMappingTypegetOwnedModelPartDeclaringType()@Nullable FetchParentAccessgetOwningParent()ObjectgetParentKey()protected Object[]getResolvedEntityState()protected DomainResultAssembler<Object>getRowIdAssembler()protected abstract StringgetSimpleConcreteImplName()Simple class name of this initializer for loggingprotected DomainResultAssembler<?>getVersionAssembler()voidinitializeInstance(RowProcessingState rowProcessingState)Step 3 - Initialize the state of the instance resolved inInitializer.resolveInstance(org.hibernate.sql.results.jdbc.spi.RowProcessingState)from the current row values.protected voidinitializeSubInstancesFromParent(RowProcessingState rowProcessingState)protected ObjectinstantiateEntity(Object entityIdentifier, SharedSessionContractImplementor session)booleanisEntityInitialized()booleanisPartOfKey()voidmarkShallowCached()protected voidpreLoad(RowProcessingState rowProcessingState)protected voidregisterLoadingEntity(RowProcessingState rowProcessingState, Object instance)protected voidregisterNaturalIdResolution(PersistenceContext persistenceContext, Object entityIdentifier)protected voidregisterPossibleUniqueKeyEntries(Object toInitialize, SharedSessionContractImplementor session)protected voidregisterReloadedEntity(RowProcessingState rowProcessingState)protected voidregisterReloadedEntity(RowProcessingState rowProcessingState, EntityHolder holder)voidregisterResolutionListener(Consumer<Object> listener)Register a listener to be notified when the parent is "resolved"protected ObjectresolveEntityInstance(Object entityIdentifier, RowProcessingState rowProcessingState)protected voidresolveEntityInstance(RowProcessingState rowProcessingState, EntityHolder holder, Object entityIdentifier)protected ObjectresolveInstance(Object entityIdentifier, EntityHolder holder, RowProcessingState rowProcessingState)Used by Hibernate ReactivevoidresolveInstance(RowProcessingState rowProcessingState)Step 2 - Using the key resolved inInitializer.resolveKey(org.hibernate.sql.results.jdbc.spi.RowProcessingState), resolve the instance (of the thing initialized) to use for the current row.voidresolveKey(RowProcessingState rowProcessingState)Step 1 - Resolve the key value for this initializer for the current row.protected voidsetEntityInstance(Object entityInstance)protected voidsetEntityInstanceForNotify(Object entityInstanceForNotify)protected voidsetResolvedEntityState(Object[] resolvedEntityState)protected booleanskipInitialization(Object toInitialize, RowProcessingState rowProcessingState)voidstartLoading(RowProcessingState rowProcessingState)protected voidtakeSnapshot(RowProcessingState rowProcessingState, SharedSessionContractImplementor session, PersistenceContext persistenceContext, EntityEntry entityEntry)protected voidupdateCaches(Object toInitialize, RowProcessingState rowProcessingState, SharedSessionContractImplementor session, PersistenceContext persistenceContext, Object entityIdentifier, Object version)-
Methods inherited from class org.hibernate.sql.results.graph.AbstractFetchParentAccess
clearResolutionListeners, isParentShallowCached, notifyResolutionListeners
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.sql.results.graph.entity.EntityInitializer
asEntityInitializer, findFirstEntityDescriptorAccess, findFirstEntityInitializer, getInitializedInstance, isEntityInitializer
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchParentAccess
shouldSkipInitializer
-
Methods inherited from interface org.hibernate.sql.results.graph.Initializer
asCollectionInitializer, asEmbeddableInitializer, initializeInstanceFromParent, isCollectionInitializer, isEmbeddableInitializer, isResultInitializer
-
-
-
-
Field Detail
-
entityInstanceForNotify
protected Object entityInstanceForNotify
-
state
protected AbstractEntityInitializer.State state
-
-
Constructor Detail
-
AbstractEntityInitializer
@Deprecated(forRemoval=true) protected AbstractEntityInitializer(EntityResultGraphNode resultDescriptor, NavigablePath navigablePath, LockMode lockMode, Fetch identifierFetch, Fetch discriminatorFetch, DomainResult<Object> rowIdResult, AssemblerCreationState creationState)
Deprecated, for removal: This API element is subject to removal in a future version.
-
AbstractEntityInitializer
protected AbstractEntityInitializer(EntityResultGraphNode resultDescriptor, NavigablePath navigablePath, LockMode lockMode, Fetch identifierFetch, Fetch discriminatorFetch, DomainResult<Object> rowIdResult, FetchParentAccess parentAccess, AssemblerCreationState creationState)
-
-
Method Detail
-
getInitializedPart
public ModelPart getInitializedPart()
- Specified by:
getInitializedPartin interfaceInitializer
-
getSimpleConcreteImplName
protected abstract String getSimpleConcreteImplName()
Simple class name of this initializer for logging
-
getNavigablePath
public NavigablePath getNavigablePath()
- Specified by:
getNavigablePathin interfaceFetchParentAccess- Specified by:
getNavigablePathin interfaceInitializer
-
getIdentifierAssembler
protected DomainResultAssembler<?> getIdentifierAssembler()
-
getEntityDescriptor
public EntityPersister getEntityDescriptor()
Description copied from interface:EntityInitializerGet the descriptor for the type of entity being initialized- Specified by:
getEntityDescriptorin interfaceEntityInitializer
-
getEntityInstance
public Object getEntityInstance()
Description copied from interface:EntityInitializerGet the entity instance for the currently processing "row".- Specified by:
getEntityInstancein interfaceEntityInitializer
-
setEntityInstance
protected void setEntityInstance(Object entityInstance)
-
getKeyValue
public Object getKeyValue()
-
getEntityKey
public EntityKey getEntityKey()
- Specified by:
getEntityKeyin interfaceEntityInitializer
-
getParentKey
public Object getParentKey()
- Specified by:
getParentKeyin interfaceFetchParentAccess
-
getFetchParentAccess
public FetchParentAccess getFetchParentAccess()
- Specified by:
getFetchParentAccessin interfaceFetchParentAccess
-
getOwningParent
public @Nullable FetchParentAccess getOwningParent()
- Specified by:
getOwningParentin interfaceFetchParentAccess
-
getOwnedModelPartDeclaringType
public @Nullable EntityMappingType getOwnedModelPartDeclaringType()
- Specified by:
getOwnedModelPartDeclaringTypein interfaceFetchParentAccess
-
registerResolutionListener
public void registerResolutionListener(Consumer<Object> listener)
Description copied from interface:FetchParentAccessRegister a listener to be notified when the parent is "resolved"- Specified by:
registerResolutionListenerin interfaceFetchParentAccess- Overrides:
registerResolutionListenerin classAbstractFetchParentAccess
-
startLoading
public void startLoading(RowProcessingState rowProcessingState)
- Specified by:
startLoadingin interfaceInitializer
-
markShallowCached
public void markShallowCached()
- Specified by:
markShallowCachedin interfaceInitializer- Overrides:
markShallowCachedin classAbstractFetchParentAccess
-
resolveKey
public void resolveKey(RowProcessingState rowProcessingState)
Description copied from interface:InitializerStep 1 - Resolve the key value for this initializer for the current row. After this point, the initializer knows the entity/collection/component key for the current row- Specified by:
resolveKeyin interfaceInitializer
-
resolveInstance
public void resolveInstance(RowProcessingState rowProcessingState)
Description copied from interface:InitializerStep 2 - Using the key resolved inInitializer.resolveKey(org.hibernate.sql.results.jdbc.spi.RowProcessingState), 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- Specified by:
resolveInstancein interfaceInitializer
-
resolveEntityInstance
protected void resolveEntityInstance(RowProcessingState rowProcessingState, EntityHolder holder, Object entityIdentifier)
-
getEntityFromExecutionContext
protected Object getEntityFromExecutionContext(RowProcessingState rowProcessingState)
-
resolveInstance
protected Object resolveInstance(Object entityIdentifier, EntityHolder holder, RowProcessingState rowProcessingState)
Used by Hibernate Reactive
-
resolveEntityInstance
protected Object resolveEntityInstance(Object entityIdentifier, RowProcessingState rowProcessingState)
-
instantiateEntity
protected Object instantiateEntity(Object entityIdentifier, SharedSessionContractImplementor session)
-
registerLoadingEntity
protected void registerLoadingEntity(RowProcessingState rowProcessingState, Object instance)
-
registerReloadedEntity
protected void registerReloadedEntity(RowProcessingState rowProcessingState)
-
registerReloadedEntity
protected void registerReloadedEntity(RowProcessingState rowProcessingState, EntityHolder holder)
-
initializeInstance
public void initializeInstance(RowProcessingState rowProcessingState)
Description copied from interface:InitializerStep 3 - Initialize the state of the instance resolved inInitializer.resolveInstance(org.hibernate.sql.results.jdbc.spi.RowProcessingState)from the current row values. All resolved state for the current row is injected into the resolved instance- Specified by:
initializeInstancein interfaceInitializer
-
consistentInstance
protected boolean consistentInstance(Object toInitialize, RowProcessingState rowProcessingState)
-
updateCaches
protected void updateCaches(Object toInitialize, RowProcessingState rowProcessingState, SharedSessionContractImplementor session, PersistenceContext persistenceContext, Object entityIdentifier, Object version)
-
registerNaturalIdResolution
protected void registerNaturalIdResolution(PersistenceContext persistenceContext, Object entityIdentifier)
-
takeSnapshot
protected void takeSnapshot(RowProcessingState rowProcessingState, SharedSessionContractImplementor session, PersistenceContext persistenceContext, EntityEntry entityEntry)
-
registerPossibleUniqueKeyEntries
protected void registerPossibleUniqueKeyEntries(Object toInitialize, SharedSessionContractImplementor session)
-
extractConcreteTypeStateValues
protected Object[] extractConcreteTypeStateValues(RowProcessingState rowProcessingState)
-
skipInitialization
protected boolean skipInitialization(Object toInitialize, RowProcessingState rowProcessingState)
-
preLoad
protected void preLoad(RowProcessingState rowProcessingState)
-
isPartOfKey
public boolean isPartOfKey()
- Specified by:
isPartOfKeyin interfaceInitializer
-
isEntityInitialized
public boolean isEntityInitialized()
- Specified by:
isEntityInitializedin interfaceEntityInitializer- Returns:
- true if the current entity associated to this EntityInitializer has been initialized
-
getConcreteDescriptor
public EntityPersister getConcreteDescriptor()
- Specified by:
getConcreteDescriptorin interfaceEntityInitializer
-
initializeSubInstancesFromParent
protected void initializeSubInstancesFromParent(RowProcessingState rowProcessingState)
-
finishUpRow
public void finishUpRow(RowProcessingState rowProcessingState)
Description copied from interface:InitializerLifecycle method called at the end of the current row processing. Provides ability to complete processing from the current row and prepare for the next row.- Specified by:
finishUpRowin interfaceInitializer
-
endLoading
public void endLoading(ExecutionContext executionContext)
Description copied from interface:InitializerLifecycle method called at the very end of the result values processing- Specified by:
endLoadingin interfaceInitializer- Overrides:
endLoadingin classAbstractFetchParentAccess
-
setEntityInstanceForNotify
protected void setEntityInstanceForNotify(Object entityInstanceForNotify)
-
getEntityInstanceForNotify
protected Object getEntityInstanceForNotify()
-
setResolvedEntityState
protected void setResolvedEntityState(Object[] resolvedEntityState)
-
getResolvedEntityState
protected Object[] getResolvedEntityState()
-
getVersionAssembler
protected DomainResultAssembler<?> getVersionAssembler()
-
getRowIdAssembler
protected DomainResultAssembler<Object> getRowIdAssembler()
-
getLockMode
protected LockMode getLockMode()
-
getAssemblers
protected DomainResultAssembler<?>[][] getAssemblers()
-
-