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
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
missing
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractEntityInitializer(EntityResultGraphNode resultDescriptor, NavigablePath navigablePath, LockMode lockMode, Fetch identifierFetch, Fetch discriminatorFetch, DomainResult<Object> rowIdResult, AssemblerCreationState creationState)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
consistentInstance(Object toInitialize, RowProcessingState rowProcessingState)
protected Object[]
extractConcreteTypeStateValues(RowProcessingState rowProcessingState)
void
finishUpRow(RowProcessingState rowProcessingState)
Lifecycle method called at the end of the current row processing.protected DomainResultAssembler<?>[][]
getAssemblers()
EntityPersister
getConcreteDescriptor()
EntityPersister
getEntityDescriptor()
Get the descriptor for the type of entity being initializedObject
getEntityInstance()
Get the entity instance for the currently processing "row".protected Object
getEntityInstanceForNotify()
protected Object
getEntityInstanceFromExecutionContext(RowProcessingState rowProcessingState)
EntityKey
getEntityKey()
protected DomainResultAssembler<?>
getIdentifierAssembler()
ModelPart
getInitializedPart()
Object
getKeyValue()
protected LockMode
getLockMode()
NavigablePath
getNavigablePath()
Object
getParentKey()
protected Object
getProxy(PersistenceContext persistenceContext)
protected Object[]
getResolvedEntityState()
protected DomainResultAssembler<Object>
getRowIdAssembler()
protected abstract String
getSimpleConcreteImplName()
Simple class name of this initializer for loggingprotected DomainResultAssembler<?>
getVersionAssembler()
void
initializeInstance(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 Object
instantiateEntity(Object entityIdentifier, SharedSessionContractImplementor session)
boolean
isEntityInitialized()
protected abstract boolean
isEntityReturn()
protected boolean
isMissing()
protected boolean
isOwningInitializer()
protected void
preLoad(RowProcessingState rowProcessingState)
protected void
registerLoadingEntity(RowProcessingState rowProcessingState, Object instance)
protected abstract void
registerLoadingEntityInstanceFromExecutionContext(RowProcessingState rowProcessingState, Object instance)
protected void
registerNaturalIdResolution(PersistenceContext persistenceContext, Object entityIdentifier)
protected void
registerPossibleUniqueKeyEntries(Object toInitialize, SharedSessionContractImplementor session)
protected void
registerReloadedEntity(RowProcessingState rowProcessingState, Object instance)
void
registerResolutionListener(Consumer<Object> listener)
Register a listener to be notified when the parent is "resolved"protected Object
resolveEntityInstance(Object entityIdentifier, RowProcessingState rowProcessingState)
protected void
resolveEntityInstance(RowProcessingState rowProcessingState, LoadingEntityEntry existingLoadingEntry, Object entityIdentifier)
protected void
resolveEntityKey(RowProcessingState rowProcessingState)
void
resolveInstance(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.void
resolveKey(RowProcessingState rowProcessingState)
Step 1 - Resolve the key value for this initializer for the current row.protected void
setEntityInitialized(boolean isInitialized)
protected void
setEntityInstanceForNotify(Object entityInstanceForNotify)
protected void
setMissing(boolean missing)
protected void
setResolvedEntityState(Object[] resolvedEntityState)
protected boolean
shouldSkipResolveInstance(RowProcessingState rowProcessingState)
protected boolean
skipInitialization(Object toInitialize, RowProcessingState rowProcessingState)
protected void
takeSnapshot(RowProcessingState rowProcessingState, SharedSessionContractImplementor session, PersistenceContext persistenceContext, EntityEntry entityEntry)
protected void
updateCaches(Object toInitialize, RowProcessingState rowProcessingState, SharedSessionContractImplementor session, PersistenceContext persistenceContext, Object entityIdentifier, Object version)
-
Methods inherited from class org.hibernate.sql.results.graph.AbstractFetchParentAccess
clearResolutionListeners, 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
getFetchParentAccess
-
Methods inherited from interface org.hibernate.sql.results.graph.Initializer
asEmbeddableInitializer, endLoading, isAttributeAssignableToConcreteDescriptor, isCollectionInitializer, isEmbeddableInitializer
-
-
-
-
Constructor Detail
-
AbstractEntityInitializer
protected AbstractEntityInitializer(EntityResultGraphNode resultDescriptor, NavigablePath navigablePath, LockMode lockMode, Fetch identifierFetch, Fetch discriminatorFetch, DomainResult<Object> rowIdResult, AssemblerCreationState creationState)
-
-
Method Detail
-
getInitializedPart
public ModelPart getInitializedPart()
- Specified by:
getInitializedPart
in interfaceInitializer
-
getSimpleConcreteImplName
protected abstract String getSimpleConcreteImplName()
Simple class name of this initializer for logging
-
getNavigablePath
public NavigablePath getNavigablePath()
- Specified by:
getNavigablePath
in interfaceFetchParentAccess
- Specified by:
getNavigablePath
in interfaceInitializer
-
getIdentifierAssembler
protected DomainResultAssembler<?> getIdentifierAssembler()
-
isMissing
protected boolean isMissing()
-
setMissing
protected void setMissing(boolean missing)
-
isEntityReturn
protected abstract boolean isEntityReturn()
-
getEntityDescriptor
public EntityPersister getEntityDescriptor()
Description copied from interface:EntityInitializer
Get the descriptor for the type of entity being initialized- Specified by:
getEntityDescriptor
in interfaceEntityInitializer
-
getEntityInstance
public Object getEntityInstance()
Description copied from interface:EntityInitializer
Get the entity instance for the currently processing "row".- Specified by:
getEntityInstance
in interfaceEntityInitializer
-
getKeyValue
public Object getKeyValue()
-
getEntityKey
public EntityKey getEntityKey()
- Specified by:
getEntityKey
in interfaceEntityInitializer
-
getParentKey
public Object getParentKey()
- Specified by:
getParentKey
in interfaceFetchParentAccess
-
registerResolutionListener
public void registerResolutionListener(Consumer<Object> listener)
Description copied from interface:FetchParentAccess
Register a listener to be notified when the parent is "resolved"- Specified by:
registerResolutionListener
in interfaceFetchParentAccess
- Overrides:
registerResolutionListener
in classAbstractFetchParentAccess
-
resolveKey
public void resolveKey(RowProcessingState rowProcessingState)
Description copied from interface:Initializer
Step 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:
resolveKey
in interfaceInitializer
-
resolveEntityKey
protected void resolveEntityKey(RowProcessingState rowProcessingState)
-
resolveInstance
public void resolveInstance(RowProcessingState rowProcessingState)
Description copied from interface:Initializer
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. After this point, the initializer knows the entity/collection/component instance for the current row based on the resolved key todo (6.0) : much of the various implementations of this are similar enough to handle in a common base implementation (templating?) things like resolving as managed (Session cache), from second-level cache, from LoadContext, etc..- Specified by:
resolveInstance
in interfaceInitializer
-
shouldSkipResolveInstance
protected boolean shouldSkipResolveInstance(RowProcessingState rowProcessingState)
-
resolveEntityInstance
protected void resolveEntityInstance(RowProcessingState rowProcessingState, LoadingEntityEntry existingLoadingEntry, Object entityIdentifier)
-
registerLoadingEntityInstanceFromExecutionContext
protected abstract void registerLoadingEntityInstanceFromExecutionContext(RowProcessingState rowProcessingState, Object instance)
-
getEntityInstanceFromExecutionContext
protected Object getEntityInstanceFromExecutionContext(RowProcessingState rowProcessingState)
-
getProxy
protected Object getProxy(PersistenceContext persistenceContext)
-
isOwningInitializer
protected boolean isOwningInitializer()
-
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, Object instance)
-
initializeInstance
public void initializeInstance(RowProcessingState rowProcessingState)
Description copied from interface:Initializer
Step 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:
initializeInstance
in 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)
-
isEntityInitialized
public boolean isEntityInitialized()
- Specified by:
isEntityInitialized
in interfaceEntityInitializer
- Returns:
- true if the current entity associated to this EntityInitializer has been initialized
-
setEntityInitialized
protected void setEntityInitialized(boolean isInitialized)
-
setEntityInstanceForNotify
protected void setEntityInstanceForNotify(Object entityInstanceForNotify)
-
getEntityInstanceForNotify
protected Object getEntityInstanceForNotify()
-
setResolvedEntityState
protected void setResolvedEntityState(Object[] resolvedEntityState)
-
getResolvedEntityState
protected Object[] getResolvedEntityState()
-
getConcreteDescriptor
public EntityPersister getConcreteDescriptor()
- Specified by:
getConcreteDescriptor
in interfaceEntityInitializer
-
getVersionAssembler
protected DomainResultAssembler<?> getVersionAssembler()
-
getRowIdAssembler
protected DomainResultAssembler<Object> getRowIdAssembler()
-
getLockMode
protected LockMode getLockMode()
-
getAssemblers
protected DomainResultAssembler<?>[][] getAssemblers()
-
finishUpRow
public void finishUpRow(RowProcessingState rowProcessingState)
Description copied from interface:Initializer
Lifecycle 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:
finishUpRow
in interfaceInitializer
-
-