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 Classes Modifier and Type Class Description static class
EmbeddableInitializerImpl.EmbeddableInitializerData
-
Nested classes/interfaces inherited from interface org.hibernate.sql.results.graph.Initializer
Initializer.State
-
-
Field Summary
Fields Modifier and Type Field Description protected DomainResultAssembler<?>[][]
assemblers
protected @Nullable Initializer<InitializerData>[][]
collectionContainingSubInitializers
protected BasicResultAssembler<?>
discriminatorAssembler
protected boolean
hasLazySubInitializer
protected boolean
lazyCapable
protected @Nullable Initializer<InitializerData>[][]
subInitializers
protected @Nullable Initializer<InitializerData>[][]
subInitializersForResolveFromInitialized
-
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 EmbeddableInitializerImpl(EmbeddableResultGraphNode resultDescriptor, BasicFetch<?> discriminatorFetch, InitializerParent<?> parent, AssemblerCreationState creationState, boolean isResultInitializer)
-
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)
EmbeddableValuedModelPart
getInitializedPart()
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.void
initializeInstance(EmbeddableInitializerImpl.EmbeddableInitializerData data)
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
isLazyCapable()
Indicates whether this initializer or one of its sub-parts could be made lazy.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
resetResolvedEntityRegistrations(RowProcessingState rowProcessingState)
Resets the resolved entity registrations by i.e.void
resolveFromPreviousRow(EmbeddableInitializerImpl.EmbeddableInitializerData 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(@Nullable Object instance, EmbeddableInitializerImpl.EmbeddableInitializerData data)
Step 2.2 - Use the given instance as resolved instance for this initializer.void
resolveInstance(EmbeddableInitializerImpl.EmbeddableInitializerData 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
resolveKey(EmbeddableInitializerImpl.EmbeddableInitializerData data)
Step 1.1 - Resolve the key value for this initializer for the current row and then recurse to the sub-initializers.void
resolveState(EmbeddableInitializerImpl.EmbeddableInitializerData data)
String
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 Detail
-
assemblers
protected final DomainResultAssembler<?>[][] assemblers
-
discriminatorAssembler
protected final BasicResultAssembler<?> discriminatorAssembler
-
subInitializers
protected final @Nullable Initializer<InitializerData>[][] subInitializers
-
subInitializersForResolveFromInitialized
protected final @Nullable Initializer<InitializerData>[][] subInitializersForResolveFromInitialized
-
collectionContainingSubInitializers
protected final @Nullable Initializer<InitializerData>[][] collectionContainingSubInitializers
-
lazyCapable
protected final boolean lazyCapable
-
hasLazySubInitializer
protected final boolean hasLazySubInitializer
-
-
Constructor Detail
-
EmbeddableInitializerImpl
public EmbeddableInitializerImpl(EmbeddableResultGraphNode resultDescriptor, BasicFetch<?> discriminatorFetch, InitializerParent<?> parent, AssemblerCreationState creationState, boolean isResultInitializer)
-
-
Method Detail
-
getInitializedPart
public EmbeddableValuedModelPart getInitializedPart()
- Specified by:
getInitializedPart
in interfaceEmbeddableInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
- Specified by:
getInitializedPart
in interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
getParent
public @Nullable InitializerParent<?> 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>
-
getNavigablePath
public NavigablePath getNavigablePath()
- Specified by:
getNavigablePath
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
protected InitializerData createInitializerData(RowProcessingState rowProcessingState)
- Specified by:
createInitializerData
in classAbstractInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resolveKey
public void resolveKey(EmbeddableInitializerImpl.EmbeddableInitializerData data)
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
public void resetResolvedEntityRegistrations(RowProcessingState rowProcessingState)
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
public void resolveFromPreviousRow(EmbeddableInitializerImpl.EmbeddableInitializerData 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<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resolveInstance
public void resolveInstance(EmbeddableInitializerImpl.EmbeddableInitializerData 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<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
public void initializeInstance(EmbeddableInitializerImpl.EmbeddableInitializerData 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<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
public void resolveState(EmbeddableInitializerImpl.EmbeddableInitializerData data)
- Specified by:
resolveState
in interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
-