Class EmbeddableInitializerImpl
java.lang.Object
org.hibernate.sql.results.graph.internal.AbstractInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
org.hibernate.sql.results.graph.embeddable.internal.EmbeddableInitializerImpl
- All Implemented Interfaces:
EmbeddableInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
,Initializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
,InitializerParent<EmbeddableInitializerImpl.EmbeddableInitializerData>
- Direct Known Subclasses:
AggregateEmbeddableInitializerImpl
public class EmbeddableInitializerImpl
extends AbstractInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
implements EmbeddableInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Nested classes/interfaces inherited from interface org.hibernate.sql.results.graph.Initializer
Initializer.State
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DomainResultAssembler<?>[][]
protected final @Nullable Initializer<InitializerData>[][]
protected final BasicResultAssembler<?>
protected final boolean
protected final boolean
protected final @Nullable Initializer<InitializerData>[][]
protected final @Nullable Initializer<InitializerData>[][]
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
ConstructorsConstructorDescriptionEmbeddableInitializerImpl
(EmbeddableResultGraphNode resultDescriptor, BasicFetch<?> discriminatorFetch, InitializerParent<?> parent, AssemblerCreationState creationState, boolean isResultInitializer) -
Method Summary
Modifier and TypeMethodDescriptionprotected InitializerData
createInitializerData
(RowProcessingState rowProcessingState) protected void
forEachSubInitializer
(BiConsumer<Initializer<?>, RowProcessingState> consumer, InitializerData data) @Nullable InitializerParent<?>
Returns the parentInitializer
ornull
if this is a result initializer.boolean
Indicates whether this initializer has sub-initializers which are lazy.void
Step 3 - Initialize the state of the instance resolved inInitializer.resolveInstance(Data)
from the current row values.void
initializeInstanceFromParent
(Object parentInstance, EmbeddableInitializerImpl.EmbeddableInitializerData 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
Indicates whether this initializer or one of its sub-parts could be made lazy.boolean
Indicates whether this initializer is part of a key i.e.boolean
Indicates if this is a result or fetch initializer.void
resetResolvedEntityRegistrations
(RowProcessingState rowProcessingState) Resets the resolved entity registrations by i.e.void
Step 1.2 - Special variant ofInitializer.resolveKey(InitializerData)
that allows the reuse of key value and instance value from the previous row.void
resolveInstance
(@Nullable Object instance, EmbeddableInitializerImpl.EmbeddableInitializerData data) Step 2.2 - Use the given instance as resolved instance for this initializer.void
Step 2.1 - Using the key resolved inInitializer.resolveKey(Data)
, resolve the instance (of the thing initialized) to use for the current row.void
Step 1.1 - Resolve the key value for this initializer for the current row and then recurse to the sub-initializers.void
toString()
Methods inherited from class org.hibernate.sql.results.graph.internal.AbstractInitializer
finishUpRow, getData, 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.embeddable.EmbeddableInitializer
asEmbeddableInitializer, isEmbeddableInitializer
Methods inherited from interface org.hibernate.sql.results.graph.Initializer
asCollectionInitializer, asEntityInitializer, endLoading, endLoading, findOwningEntityInitializer, finishUpRow, finishUpRow, getData, getResolvedInstance, getResolvedInstance, initializeInstance, initializeInstanceFromParent, isCollectionInitializer, isEntityInitializer, resolveFromPreviousRow, resolveInstance, resolveInstance, resolveKey, resolveState, startLoading
-
Field Details
-
assemblers
-
discriminatorAssembler
-
subInitializers
-
subInitializersForResolveFromInitialized
-
collectionContainingSubInitializers
-
lazyCapable
protected final boolean lazyCapable -
hasLazySubInitializer
protected final boolean hasLazySubInitializer
-
-
Constructor Details
-
EmbeddableInitializerImpl
public EmbeddableInitializerImpl(EmbeddableResultGraphNode resultDescriptor, BasicFetch<?> discriminatorFetch, InitializerParent<?> parent, AssemblerCreationState creationState, boolean isResultInitializer)
-
-
Method Details
-
getInitializedPart
- Specified by:
getInitializedPart
in interfaceEmbeddableInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
- Specified by:
getInitializedPart
in interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
getParent
Description copied from interface:Initializer
Returns the parentInitializer
ornull
if this is a result initializer.- Specified by:
getParent
in interfaceEmbeddableInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
- Specified by:
getParent
in interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
isResultInitializer
public boolean isResultInitializer()Description copied from interface:Initializer
Indicates if this is a result or fetch initializer.- Specified by:
isResultInitializer
in interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
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<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
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<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
isLazyCapable
public boolean isLazyCapable()Description copied from interface:Initializer
Indicates whether this initializer or one of its sub-parts could be made lazy.- Specified by:
isLazyCapable
in interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
hasLazySubInitializers
public boolean hasLazySubInitializers()Description copied from interface:Initializer
Indicates whether this initializer has sub-initializers which are lazy.- Specified by:
hasLazySubInitializers
in interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
createInitializerData
- Specified by:
createInitializerData
in classAbstractInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resolveKey
Description copied from interface:Initializer
Step 1.1 - Resolve the key value for this initializer for the current row and then recurse to the sub-initializers. After this point, the initializer knows whether further processing is necessary for the current row i.e. if the object is missing.- Specified by:
resolveKey
in interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
- Overrides:
resolveKey
in classAbstractInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resetResolvedEntityRegistrations
Description copied from interface:EmbeddableInitializer
Resets the resolved entity registrations by i.e. removingEntityHolder
. This is used afterEntityInitializer.resolveEntityKeyOnly(RowProcessingState)
to deregister registrations for entities that were only resolved, but not initialized. Failing to do this will lead to errors, becausePersistenceContext.postLoad(JdbcValuesSourceProcessingState, Consumer)
is called, which expects all registrations to be fully initialized.- Specified by:
resetResolvedEntityRegistrations
in interfaceEmbeddableInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resolveFromPreviousRow
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<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resolveInstance
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<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resolveInstance
public void resolveInstance(@Nullable Object instance, EmbeddableInitializerImpl.EmbeddableInitializerData 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<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
initializeInstance
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<EmbeddableInitializerImpl.EmbeddableInitializerData>
- Overrides:
initializeInstance
in classAbstractInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
forEachSubInitializer
protected void forEachSubInitializer(BiConsumer<Initializer<?>, RowProcessingState> consumer, InitializerData data) - Specified by:
forEachSubInitializer
in classAbstractInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
initializeInstanceFromParent
public void initializeInstanceFromParent(Object parentInstance, EmbeddableInitializerImpl.EmbeddableInitializerData 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<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resolveState
- Specified by:
resolveState
in interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
toString
-