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 voidendLoading(ExecutionContext executionContext)Lifecycle method called at the very end of the result values processingvoidfinishUpRow(RowProcessingState rowProcessingState)Lifecycle method called at the end of the current row processing.protected abstract voidforEachAssembler(Consumer<DomainResultAssembler<?>> consumer)protected abstract StringgetSimpleConcreteImplName()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.voidinitializeInstanceFromParent(Object parentInstance, RowProcessingState rowProcessingState)Step 3.1 - Initialize the state of the instance as extracted from the given parentInstance.protected abstract voidinitializeSubInstancesFromParent(RowProcessingState rowProcessingState)voidmarkShallowCached()protected abstract voidreadCollectionRow(CollectionKey collectionKey, List<Object> loadingState, RowProcessingState rowProcessingState)voidresolveInstance(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.voidstartLoading(RowProcessingState rowProcessingState)protected voidtakeResponsibility(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:
markShallowCachedin interfaceInitializer- Overrides:
markShallowCachedin classAbstractCollectionInitializer
-
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
-
takeResponsibility
protected void takeResponsibility(RowProcessingState rowProcessingState, CollectionKey collectionKey)
-
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- Overrides:
resolveKeyin classAbstractCollectionInitializer
-
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
-
initializeInstanceFromParent
public void initializeInstanceFromParent(Object parentInstance, RowProcessingState rowProcessingState)
Description copied from interface:InitializerStep 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 theJdbcValuesCacheHitto 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: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- Overrides:
finishUpRowin classAbstractCollectionInitializer
-
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 classAbstractCollectionInitializer
-
-