Class EntitySelectFetchInitializer
- java.lang.Object
-
- org.hibernate.sql.results.graph.entity.internal.EntitySelectFetchInitializer
-
- All Implemented Interfaces:
EntityInitializer,FetchParentAccess,Initializer
- Direct Known Subclasses:
EntitySelectFetchByUniqueKeyInitializer
public class EntitySelectFetchInitializer extends Object implements EntityInitializer
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classEntitySelectFetchInitializer.State
-
Field Summary
Fields Modifier and Type Field Description protected EntityPersisterconcreteDescriptorprotected ObjectentityIdentifierprotected ObjectentityInstanceprotected DomainResultAssembler<?>keyAssemblerprotected FetchParentAccessparentAccessprotected booleanparentShallowCachedprotected EntitySelectFetchInitializer.Statestate
-
Constructor Summary
Constructors Constructor Description EntitySelectFetchInitializer(FetchParentAccess parentAccess, ToOneAttributeMapping toOneMapping, NavigablePath fetchedNavigable, EntityPersister concreteDescriptor, DomainResultAssembler<?> keyAssembler)
-
Method Summary
All Methods Instance 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.EntityPersistergetConcreteDescriptor()EntityPersistergetEntityDescriptor()Get the descriptor for the type of entity being initializedObjectgetEntityInstance()Get the entity instance for the currently processing "row".EntityKeygetEntityKey()FetchParentAccessgetFetchParentAccess()ModelPartgetInitializedPart()NavigablePathgetNavigablePath()@Nullable EntityMappingTypegetOwnedModelPartDeclaringType()@Nullable FetchParentAccessgetOwningParent()ObjectgetParentKey()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.booleanisEntityInitialized()booleanisPartOfKey()booleanisResultInitializer()voidmarkShallowCached()voidregisterResolutionListener(Consumer<Object> listener)Register a listener to be notified when the parent is "resolved"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.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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, isCollectionInitializer, isEmbeddableInitializer, startLoading
-
-
-
-
Field Detail
-
parentAccess
protected final FetchParentAccess parentAccess
-
concreteDescriptor
protected final EntityPersister concreteDescriptor
-
keyAssembler
protected final DomainResultAssembler<?> keyAssembler
-
parentShallowCached
protected boolean parentShallowCached
-
state
protected EntitySelectFetchInitializer.State state
-
entityIdentifier
protected Object entityIdentifier
-
entityInstance
protected Object entityInstance
-
-
Constructor Detail
-
EntitySelectFetchInitializer
public EntitySelectFetchInitializer(FetchParentAccess parentAccess, ToOneAttributeMapping toOneMapping, NavigablePath fetchedNavigable, EntityPersister concreteDescriptor, DomainResultAssembler<?> keyAssembler)
-
-
Method Detail
-
getInitializedPart
public ModelPart getInitializedPart()
- Specified by:
getInitializedPartin interfaceInitializer
-
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
-
getNavigablePath
public NavigablePath getNavigablePath()
- Specified by:
getNavigablePathin interfaceFetchParentAccess- Specified by:
getNavigablePathin interfaceInitializer
-
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
-
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
-
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.- Specified by:
initializeInstanceFromParentin interfaceInitializer
-
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
-
markShallowCached
public void markShallowCached()
- Specified by:
markShallowCachedin 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
-
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
-
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
-
isPartOfKey
public boolean isPartOfKey()
- Specified by:
isPartOfKeyin interfaceInitializer
-
isResultInitializer
public boolean isResultInitializer()
- Specified by:
isResultInitializerin interfaceInitializer
-
getEntityKey
public EntityKey getEntityKey()
- Specified by:
getEntityKeyin interfaceEntityInitializer
-
getParentKey
public Object getParentKey()
- Specified by:
getParentKeyin 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
-
-