Class AbstractBatchEntitySelectFetchInitializer
- java.lang.Object
-
- org.hibernate.sql.results.graph.entity.internal.AbstractBatchEntitySelectFetchInitializer
-
- All Implemented Interfaces:
EntityInitializer
,FetchParentAccess
,Initializer
- Direct Known Subclasses:
BatchEntityInsideEmbeddableSelectFetchInitializer
,BatchEntitySelectFetchInitializer
,BatchInitializeEntitySelectFetchInitializer
public abstract class AbstractBatchEntitySelectFetchInitializer extends Object implements EntityInitializer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractBatchEntitySelectFetchInitializer.State
-
Field Summary
Fields Modifier and Type Field Description protected EntityPersister
concreteDescriptor
protected EntityKey
entityKey
protected EntityInitializer
firstEntityInitializer
protected DomainResultAssembler<?>
identifierAssembler
protected Object
initializedEntityInstance
protected FetchParentAccess
parentAccess
protected boolean
parentShallowCached
protected ToOneAttributeMapping
referencedModelPart
protected AbstractBatchEntitySelectFetchInitializer.State
state
-
Constructor Summary
Constructors Constructor Description AbstractBatchEntitySelectFetchInitializer(FetchParentAccess parentAccess, ToOneAttributeMapping referencedModelPart, NavigablePath fetchedNavigable, EntityPersister concreteDescriptor, DomainResultAssembler<?> identifierAssembler)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
endLoading(ExecutionContext executionContext)
Lifecycle method called at the very end of the result values processingvoid
finishUpRow(RowProcessingState rowProcessingState)
Lifecycle method called at the end of the current row processing.EntityPersister
getConcreteDescriptor()
EntityPersister
getEntityDescriptor()
Get the descriptor for the type of entity being initializedObject
getEntityInstance()
Get the entity instance for the currently processing "row".EntityKey
getEntityKey()
protected Object
getExistingInitializedInstance(RowProcessingState rowProcessingState)
FetchParentAccess
getFetchParentAccess()
ModelPart
getInitializedPart()
NavigablePath
getNavigablePath()
@Nullable EntityMappingType
getOwnedModelPartDeclaringType()
@Nullable FetchParentAccess
getOwningParent()
protected AttributeMapping
getParentEntityAttribute(String attributeName)
Object
getParentKey()
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.void
initializeInstanceFromParent(Object parentInstance, RowProcessingState rowProcessingState)
Step 3.1 - Initialize the state of the instance as extracted from the given parentInstance.boolean
isPartOfKey()
boolean
isResultInitializer()
protected static Object
loadInstance(EntityKey entityKey, ToOneAttributeMapping referencedModelPart, SharedSessionContractImplementor session)
void
markShallowCached()
protected abstract void
registerResolutionListener()
void
registerResolutionListener(Consumer<Object> listener)
Register a listener to be notified when the parent is "resolved"protected void
registerToBatchFetchQueue(RowProcessingState rowProcessingState)
void
resolveKey(RowProcessingState rowProcessingState)
Step 1 - Resolve the key value for this initializer for the current row.-
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, isEntityInitialized, isEntityInitializer
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchParentAccess
shouldSkipInitializer
-
Methods inherited from interface org.hibernate.sql.results.graph.Initializer
asCollectionInitializer, asEmbeddableInitializer, isCollectionInitializer, isEmbeddableInitializer, resolveInstance, startLoading
-
-
-
-
Field Detail
-
parentAccess
protected final FetchParentAccess parentAccess
-
concreteDescriptor
protected final EntityPersister concreteDescriptor
-
identifierAssembler
protected final DomainResultAssembler<?> identifierAssembler
-
referencedModelPart
protected final ToOneAttributeMapping referencedModelPart
-
firstEntityInitializer
protected final EntityInitializer firstEntityInitializer
-
parentShallowCached
protected boolean parentShallowCached
-
initializedEntityInstance
protected Object initializedEntityInstance
-
entityKey
protected EntityKey entityKey
-
state
protected AbstractBatchEntitySelectFetchInitializer.State state
-
-
Constructor Detail
-
AbstractBatchEntitySelectFetchInitializer
public AbstractBatchEntitySelectFetchInitializer(FetchParentAccess parentAccess, ToOneAttributeMapping referencedModelPart, NavigablePath fetchedNavigable, EntityPersister concreteDescriptor, DomainResultAssembler<?> identifierAssembler)
-
-
Method Detail
-
getInitializedPart
public ModelPart getInitializedPart()
- Specified by:
getInitializedPart
in interfaceInitializer
-
getNavigablePath
public NavigablePath getNavigablePath()
- Specified by:
getNavigablePath
in interfaceFetchParentAccess
- Specified by:
getNavigablePath
in interfaceInitializer
-
isPartOfKey
public boolean isPartOfKey()
- Specified by:
isPartOfKey
in interfaceInitializer
-
isResultInitializer
public boolean isResultInitializer()
- Specified by:
isResultInitializer
in interfaceInitializer
-
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
-
registerResolutionListener
protected abstract void registerResolutionListener()
-
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
-
getExistingInitializedInstance
protected Object getExistingInitializedInstance(RowProcessingState rowProcessingState)
-
registerToBatchFetchQueue
protected void registerToBatchFetchQueue(RowProcessingState rowProcessingState)
-
initializeInstanceFromParent
public void initializeInstanceFromParent(Object parentInstance, RowProcessingState rowProcessingState)
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
-
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
-
markShallowCached
public void markShallowCached()
- Specified by:
markShallowCached
in interfaceInitializer
-
endLoading
public void endLoading(ExecutionContext executionContext)
Description copied from interface:Initializer
Lifecycle method called at the very end of the result values processing- Specified by:
endLoading
in interfaceInitializer
-
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
-
loadInstance
protected static Object loadInstance(EntityKey entityKey, ToOneAttributeMapping referencedModelPart, SharedSessionContractImplementor session)
-
getParentEntityAttribute
protected AttributeMapping getParentEntityAttribute(String attributeName)
-
getFetchParentAccess
public FetchParentAccess getFetchParentAccess()
- Specified by:
getFetchParentAccess
in interfaceFetchParentAccess
-
getOwningParent
public @Nullable FetchParentAccess getOwningParent()
- Specified by:
getOwningParent
in interfaceFetchParentAccess
-
getOwnedModelPartDeclaringType
public @Nullable EntityMappingType getOwnedModelPartDeclaringType()
- Specified by:
getOwnedModelPartDeclaringType
in interfaceFetchParentAccess
-
getConcreteDescriptor
public EntityPersister getConcreteDescriptor()
- Specified by:
getConcreteDescriptor
in interfaceEntityInitializer
-
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
-
-