Class AbstractImmediateCollectionInitializer
- java.lang.Object
-
- org.hibernate.sql.results.graph.collection.internal.AbstractCollectionInitializer
-
- org.hibernate.sql.results.graph.collection.internal.AbstractImmediateCollectionInitializer
-
- All Implemented Interfaces:
CollectionInitializer
,FetchParentAccess
,Initializer
- Direct Known Subclasses:
ArrayInitializer
,BagInitializer
,ListInitializer
,MapInitializer
,SetInitializer
public abstract class AbstractImmediateCollectionInitializer extends AbstractCollectionInitializer
Base support for CollectionInitializer implementations that represent an immediate initialization of some sort (join, select, batch, sub-select) for a persistent collection.- Implementation Note:
- Mainly an intention contract wrt the immediacy of the fetch.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.hibernate.sql.results.graph.collection.internal.AbstractCollectionInitializer
AbstractCollectionInitializer.State
-
-
Field Summary
-
Fields inherited from class org.hibernate.sql.results.graph.collection.internal.AbstractCollectionInitializer
collectionAttributeMapping, collectionInstance, collectionKey, collectionKeyResultAssembler, isResultInitializer, parentAccess, parentShallowCached, state
-
-
Constructor Summary
Constructors Constructor Description AbstractImmediateCollectionInitializer(NavigablePath collectionPath, PluralAttributeMapping collectionAttributeMapping, FetchParentAccess parentAccess, LockMode lockMode, DomainResult<?> collectionKeyResult, DomainResult<?> collectionValueKeyResult, boolean isResultInitializer, AssemblerCreationState creationState)
-
Method Summary
All 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.protected abstract void
forEachAssembler(Consumer<DomainResultAssembler<?>> consumer)
protected abstract String
getSimpleConcreteImplName()
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.protected abstract void
initializeSubInstancesFromParent(RowProcessingState rowProcessingState)
void
markShallowCached()
protected abstract void
readCollectionRow(CollectionKey collectionKey, List<Object> loadingState, 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.void
startLoading(RowProcessingState rowProcessingState)
protected void
takeResponsibility(RowProcessingState rowProcessingState, CollectionKey collectionKey)
-
Methods inherited from class org.hibernate.sql.results.graph.collection.internal.AbstractCollectionInitializer
findFirstEntityDescriptorAccess, getCollectionAttributeMapping, getCollectionInstance, getFetchParentAccess, getInitializedPart, getNavigablePath, getOwnedModelPartDeclaringType, getOwningParent, getParentKey, isPartOfKey, isResultInitializer, registerResolutionListener, resolveCollectionKey, resolveInstance
-
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.collection.CollectionInitializer
asCollectionInitializer, getInitializedInstance, getInitializingCollectionDescriptor, isCollectionInitializer
-
Methods inherited from interface org.hibernate.sql.results.graph.FetchParentAccess
findFirstEntityInitializer, shouldSkipInitializer
-
Methods inherited from interface org.hibernate.sql.results.graph.Initializer
asEmbeddableInitializer, asEntityInitializer, isEmbeddableInitializer, isEntityInitializer
-
-
-
-
Constructor Detail
-
AbstractImmediateCollectionInitializer
public AbstractImmediateCollectionInitializer(NavigablePath collectionPath, PluralAttributeMapping collectionAttributeMapping, FetchParentAccess parentAccess, LockMode lockMode, DomainResult<?> collectionKeyResult, DomainResult<?> collectionValueKeyResult, boolean isResultInitializer, AssemblerCreationState creationState)
-
-
Method Detail
-
getSimpleConcreteImplName
protected abstract String getSimpleConcreteImplName()
-
forEachAssembler
protected abstract void forEachAssembler(Consumer<DomainResultAssembler<?>> consumer)
-
startLoading
public void startLoading(RowProcessingState rowProcessingState)
-
markShallowCached
public void markShallowCached()
- Specified by:
markShallowCached
in interfaceInitializer
- Overrides:
markShallowCached
in classAbstractCollectionInitializer
-
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
-
takeResponsibility
protected void takeResponsibility(RowProcessingState rowProcessingState, CollectionKey collectionKey)
-
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
- Overrides:
resolveKey
in classAbstractCollectionInitializer
-
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
-
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.
-
readCollectionRow
protected abstract void readCollectionRow(CollectionKey collectionKey, List<Object> loadingState, RowProcessingState rowProcessingState)
-
initializeSubInstancesFromParent
protected abstract void initializeSubInstancesFromParent(RowProcessingState rowProcessingState)
-
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
- Overrides:
finishUpRow
in classAbstractCollectionInitializer
-
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
- Overrides:
endLoading
in classAbstractCollectionInitializer
-
-