Class EntitySelectFetchInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
- java.lang.Object
-
- org.hibernate.sql.results.graph.internal.AbstractInitializer<Data>
-
- org.hibernate.sql.results.graph.entity.internal.EntitySelectFetchInitializer<Data>
-
- All Implemented Interfaces:
EntityInitializer<Data>
,Initializer<Data>
,InitializerParent<Data>
- Direct Known Subclasses:
AbstractBatchEntitySelectFetchInitializer
,EntitySelectFetchByUniqueKeyInitializer
public class EntitySelectFetchInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData> extends AbstractInitializer<Data> implements EntityInitializer<Data>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EntitySelectFetchInitializer.EntitySelectFetchInitializerData
-
Nested classes/interfaces inherited from interface org.hibernate.sql.results.graph.Initializer
Initializer.State
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
affectedByFilter
protected EntityPersister
concreteDescriptor
protected boolean
hasLazySubInitializer
protected DomainResultAssembler<?>
keyAssembler
protected boolean
keyIsEager
protected InitializerParent<?>
parent
protected ToOneAttributeMapping
toOneMapping
-
Fields inherited from class org.hibernate.sql.results.graph.internal.AbstractInitializer
initializerId
-
Fields inherited from interface org.hibernate.sql.results.graph.Initializer
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description EntitySelectFetchInitializer(InitializerParent<?> parent, ToOneAttributeMapping toOneMapping, NavigablePath fetchedNavigable, EntityPersister concreteDescriptor, DomainResult<?> keyResult, boolean affectedByFilter, AssemblerCreationState creationState)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected InitializerData
createInitializerData(RowProcessingState rowProcessingState)
protected void
forEachSubInitializer(BiConsumer<Initializer<?>,RowProcessingState> consumer, InitializerData data)
EntityPersister
getConcreteDescriptor(Data data)
EntityPersister
getEntityDescriptor()
Get the descriptor for the type of entity being initialized@Nullable Object
getEntityIdentifier(Data data)
ModelPart
getInitializedPart()
DomainResultAssembler<?>
getKeyAssembler()
NavigablePath
getNavigablePath()
@Nullable InitializerParent<?>
getParent()
Returns the parentInitializer
ornull
if this is a result initializer.boolean
hasLazySubInitializers()
Indicates whether this initializer has sub-initializers which are lazy.protected void
initialize(EntitySelectFetchInitializer.EntitySelectFetchInitializerData data)
void
initializeInstance(Data data)
Step 3 - Initialize the state of the instance resolved inInitializer.resolveInstance(Data)
from the current row values.void
initializeInstanceFromParent(Object parentInstance, Data data)
Step 3.1 - Initialize the state of the instance as extracted from the given parentInstance.boolean
isEager()
Indicates whether calling resolve is needed when the object for this initializer is initialized already.boolean
isPartOfKey()
Indicates whether this initializer is part of a key i.e.boolean
isResultInitializer()
Indicates if this is a result or fetch initializer.void
resolveFromPreviousRow(Data data)
Step 1.2 - Special variant ofInitializer.resolveKey(InitializerData)
that allows the reuse of key value and instance value from the previous row.void
resolveInstance(Data data)
Step 2.1 - Using the key resolved inInitializer.resolveKey(Data)
, resolve the instance (of the thing initialized) to use for the current row.void
resolveInstance(Object instance, Data data)
Step 2.2 - Use the given instance as resolved instance for this initializer.void
resolveState(EntitySelectFetchInitializer.EntitySelectFetchInitializerData data)
String
toString()
-
Methods inherited from class org.hibernate.sql.results.graph.internal.AbstractInitializer
finishUpRow, getData, resolveKey, startLoading
-
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, getConcreteDescriptor, getEntityIdentifier, getTargetInstance, getTargetInstance, isEntityInitializer, resetResolvedEntityRegistrations, resolveEntityKeyOnly
-
Methods inherited from interface org.hibernate.sql.results.graph.Initializer
asCollectionInitializer, asEmbeddableInitializer, endLoading, endLoading, findOwningEntityInitializer, finishUpRow, finishUpRow, getData, getResolvedInstance, getResolvedInstance, initializeInstance, initializeInstanceFromParent, isCollectionInitializer, isEmbeddableInitializer, isLazyCapable, resolveFromPreviousRow, resolveInstance, resolveInstance, resolveKey, resolveKey, resolveState, startLoading
-
-
-
-
Field Detail
-
parent
protected final InitializerParent<?> parent
-
concreteDescriptor
protected final EntityPersister concreteDescriptor
-
keyAssembler
protected final DomainResultAssembler<?> keyAssembler
-
toOneMapping
protected final ToOneAttributeMapping toOneMapping
-
affectedByFilter
protected final boolean affectedByFilter
-
keyIsEager
protected final boolean keyIsEager
-
hasLazySubInitializer
protected final boolean hasLazySubInitializer
-
-
Constructor Detail
-
EntitySelectFetchInitializer
public EntitySelectFetchInitializer(InitializerParent<?> parent, ToOneAttributeMapping toOneMapping, NavigablePath fetchedNavigable, EntityPersister concreteDescriptor, DomainResult<?> keyResult, boolean affectedByFilter, AssemblerCreationState creationState)
-
-
Method Detail
-
createInitializerData
protected InitializerData createInitializerData(RowProcessingState rowProcessingState)
- Specified by:
createInitializerData
in classAbstractInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
getInitializedPart
public ModelPart getInitializedPart()
- Specified by:
getInitializedPart
in interfaceInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
getParent
public @Nullable InitializerParent<?> getParent()
Description copied from interface:Initializer
Returns the parentInitializer
ornull
if this is a result initializer.- Specified by:
getParent
in interfaceInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
getNavigablePath
public NavigablePath getNavigablePath()
- Specified by:
getNavigablePath
in interfaceInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
resolveFromPreviousRow
public void resolveFromPreviousRow(Data data)
Description copied from interface:Initializer
Step 1.2 - Special variant ofInitializer.resolveKey(InitializerData)
that allows the reuse of key value and instance value from the previous row.- Specified by:
resolveFromPreviousRow
in interfaceInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
resolveInstance
public void resolveInstance(Data data)
Description copied from interface:Initializer
Step 2.1 - Using the key resolved inInitializer.resolveKey(Data)
, 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. If the resolving was successful,Initializer.getResolvedInstance(RowProcessingState)
will return that instance.- Specified by:
resolveInstance
in interfaceInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
resolveInstance
public void resolveInstance(Object instance, Data data)
Description copied from interface:Initializer
Step 2.2 - Use the given instance as resolved instance for this initializer. Initializers are supposed to recursively call this method for sub-initializers. This alternative initialization protocol is used when a parent instance was already part of the persistence context.- Specified by:
resolveInstance
in interfaceInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
initializeInstance
public void initializeInstance(Data data)
Description copied from interface:Initializer
Step 3 - Initialize the state of the instance resolved inInitializer.resolveInstance(Data)
from the current row values. All resolved state for the current row is injected into the resolved instance- Specified by:
initializeInstance
in interfaceInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
- Overrides:
initializeInstance
in classAbstractInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
initialize
protected void initialize(EntitySelectFetchInitializer.EntitySelectFetchInitializerData data)
-
initializeInstanceFromParent
public void initializeInstanceFromParent(Object parentInstance, Data data)
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<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
forEachSubInitializer
protected void forEachSubInitializer(BiConsumer<Initializer<?>,RowProcessingState> consumer, InitializerData data)
- Specified by:
forEachSubInitializer
in classAbstractInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
getEntityDescriptor
public EntityPersister getEntityDescriptor()
Description copied from interface:EntityInitializer
Get the descriptor for the type of entity being initialized- Specified by:
getEntityDescriptor
in interfaceEntityInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
getConcreteDescriptor
public EntityPersister getConcreteDescriptor(Data data)
- Specified by:
getConcreteDescriptor
in interfaceEntityInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
getEntityIdentifier
public @Nullable Object getEntityIdentifier(Data data)
- Specified by:
getEntityIdentifier
in interfaceEntityInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
isPartOfKey
public boolean isPartOfKey()
Description copied from interface:Initializer
Indicates whether this initializer is part of a key i.e. entity identifier, foreign key or collection key.- Specified by:
isPartOfKey
in interfaceInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
isEager
public boolean isEager()
Description copied from interface:Initializer
Indicates whether calling resolve is needed when the object for this initializer is initialized already.- Specified by:
isEager
in interfaceInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
resolveState
public void resolveState(EntitySelectFetchInitializer.EntitySelectFetchInitializerData data)
- Specified by:
resolveState
in interfaceInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
hasLazySubInitializers
public boolean hasLazySubInitializers()
Description copied from interface:Initializer
Indicates whether this initializer has sub-initializers which are lazy.- Specified by:
hasLazySubInitializers
in interfaceInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
isResultInitializer
public boolean isResultInitializer()
Description copied from interface:Initializer
Indicates if this is a result or fetch initializer.- Specified by:
isResultInitializer
in interfaceInitializer<Data extends EntitySelectFetchInitializer.EntitySelectFetchInitializerData>
-
getKeyAssembler
public DomainResultAssembler<?> getKeyAssembler()
-
-