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 classEmbeddableInitializerImpl.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<?>[][]assemblersprotected @Nullable Initializer<InitializerData>[][]collectionContainingSubInitializersprotected BasicResultAssembler<?>discriminatorAssemblerprotected booleanhasLazySubInitializerprotected booleanlazyCapableprotected @Nullable DomainResultAssembler<Boolean>nullIndicatorAssemblerprotected @Nullable Initializer<InitializerData>[][]subInitializersprotected @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, @Nullable DomainResult<Boolean> nullIndicatorResult, InitializerParent<?> parent, AssemblerCreationState creationState, boolean isResultInitializer)EmbeddableInitializerImpl(EmbeddableResultGraphNode resultDescriptor, BasicFetch<?> discriminatorFetch, InitializerParent<?> parent, AssemblerCreationState creationState, boolean isResultInitializer)Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected InitializerDatacreateInitializerData(RowProcessingState rowProcessingState)protected voidextractRowState(EmbeddableInitializerImpl.EmbeddableInitializerData data)protected voidforEachSubInitializer(BiConsumer<Initializer<?>,RowProcessingState> consumer, InitializerData data)EmbeddableValuedModelPartgetInitializedPart()NavigablePathgetNavigablePath()@Nullable InitializerParent<?>getParent()Returns the parentInitializerornullif this is a result initializer.booleanhasLazySubInitializers()Indicates whether this initializer has sub-initializers which are lazy.voidinitializeInstance(EmbeddableInitializerImpl.EmbeddableInitializerData data)Step 3 - Initialize the state of the instance resolved inInitializer.resolveInstance(Data)from the current row values.voidinitializeInstanceFromParent(Object parentInstance, EmbeddableInitializerImpl.EmbeddableInitializerData data)Step 3.1 - Initialize the state of the instance as extracted from the given parentInstance.booleanisEager()Indicates whether calling resolve is needed when the object for this initializer is initialized already.booleanisLazyCapable()Indicates whether this initializer or one of its sub-parts could be made lazy.protected booleanisNull(EmbeddableInitializerImpl.EmbeddableInitializerData data)booleanisPartOfKey()Indicates whether this initializer is part of a key i.e.booleanisResultInitializer()Indicates if this is a result or fetch initializer.voidresetResolvedEntityRegistrations(RowProcessingState rowProcessingState)Resets the resolved entity registrations by i.e.voidresolveFromPreviousRow(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.voidresolveInstance(@Nullable Object instance, EmbeddableInitializerImpl.EmbeddableInitializerData data)Step 2.2 - Use the given instance as resolved instance for this initializer.voidresolveInstance(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.voidresolveKey(EmbeddableInitializerImpl.EmbeddableInitializerData data)Step 1.1 - Resolve the key value for this initializer for the current row and then recurse to the sub-initializers.voidresolveState(EmbeddableInitializerImpl.EmbeddableInitializerData data)StringtoString()-
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
-
Methods inherited from interface org.hibernate.sql.results.graph.InitializerParent
getResolvedInstanceNoProxy
-
-
-
-
Field Detail
-
assemblers
protected final DomainResultAssembler<?>[][] assemblers
-
discriminatorAssembler
protected final BasicResultAssembler<?> discriminatorAssembler
-
nullIndicatorAssembler
protected final @Nullable DomainResultAssembler<Boolean> nullIndicatorAssembler
-
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
@Deprecated(forRemoval=true) public EmbeddableInitializerImpl(EmbeddableResultGraphNode resultDescriptor, BasicFetch<?> discriminatorFetch, InitializerParent<?> parent, AssemblerCreationState creationState, boolean isResultInitializer)
Deprecated, for removal: This API element is subject to removal in a future version.
-
EmbeddableInitializerImpl
public EmbeddableInitializerImpl(EmbeddableResultGraphNode resultDescriptor, BasicFetch<?> discriminatorFetch, @Nullable DomainResult<Boolean> nullIndicatorResult, InitializerParent<?> parent, AssemblerCreationState creationState, boolean isResultInitializer)
-
-
Method Detail
-
getInitializedPart
public EmbeddableValuedModelPart getInitializedPart()
- Specified by:
getInitializedPartin interfaceEmbeddableInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>- Specified by:
getInitializedPartin interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
getParent
public @Nullable InitializerParent<?> getParent()
Description copied from interface:InitializerReturns the parentInitializerornullif this is a result initializer.- Specified by:
getParentin interfaceEmbeddableInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>- Specified by:
getParentin interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
getNavigablePath
public NavigablePath getNavigablePath()
- Specified by:
getNavigablePathin interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
isResultInitializer
public boolean isResultInitializer()
Description copied from interface:InitializerIndicates if this is a result or fetch initializer.- Specified by:
isResultInitializerin interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
isPartOfKey
public boolean isPartOfKey()
Description copied from interface:InitializerIndicates whether this initializer is part of a key i.e. entity identifier, foreign key or collection key.- Specified by:
isPartOfKeyin interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
isEager
public boolean isEager()
Description copied from interface:InitializerIndicates whether calling resolve is needed when the object for this initializer is initialized already.- Specified by:
isEagerin interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
isLazyCapable
public boolean isLazyCapable()
Description copied from interface:InitializerIndicates whether this initializer or one of its sub-parts could be made lazy.- Specified by:
isLazyCapablein interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
hasLazySubInitializers
public boolean hasLazySubInitializers()
Description copied from interface:InitializerIndicates whether this initializer has sub-initializers which are lazy.- Specified by:
hasLazySubInitializersin interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
createInitializerData
protected InitializerData createInitializerData(RowProcessingState rowProcessingState)
- Specified by:
createInitializerDatain classAbstractInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resolveKey
public void resolveKey(EmbeddableInitializerImpl.EmbeddableInitializerData data)
Description copied from interface:InitializerStep 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:
resolveKeyin interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>- Overrides:
resolveKeyin classAbstractInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resetResolvedEntityRegistrations
public void resetResolvedEntityRegistrations(RowProcessingState rowProcessingState)
Description copied from interface:EmbeddableInitializerResets 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:
resetResolvedEntityRegistrationsin interfaceEmbeddableInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resolveFromPreviousRow
public void resolveFromPreviousRow(EmbeddableInitializerImpl.EmbeddableInitializerData data)
Description copied from interface:InitializerStep 1.2 - Special variant ofInitializer.resolveKey(InitializerData)that allows the reuse of key value and instance value from the previous row.- Specified by:
resolveFromPreviousRowin interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resolveInstance
public void resolveInstance(EmbeddableInitializerImpl.EmbeddableInitializerData data)
Description copied from interface:InitializerStep 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:
resolveInstancein interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
resolveInstance
public void resolveInstance(@Nullable Object instance, EmbeddableInitializerImpl.EmbeddableInitializerData data)
Description copied from interface:InitializerStep 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:
resolveInstancein interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
initializeInstance
public void initializeInstance(EmbeddableInitializerImpl.EmbeddableInitializerData data)
Description copied from interface:InitializerStep 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:
initializeInstancein interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>- Overrides:
initializeInstancein classAbstractInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
forEachSubInitializer
protected void forEachSubInitializer(BiConsumer<Initializer<?>,RowProcessingState> consumer, InitializerData data)
- Specified by:
forEachSubInitializerin classAbstractInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
initializeInstanceFromParent
public void initializeInstanceFromParent(Object parentInstance, EmbeddableInitializerImpl.EmbeddableInitializerData data)
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<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
extractRowState
protected void extractRowState(EmbeddableInitializerImpl.EmbeddableInitializerData data)
-
isNull
protected boolean isNull(EmbeddableInitializerImpl.EmbeddableInitializerData data)
-
resolveState
public void resolveState(EmbeddableInitializerImpl.EmbeddableInitializerData data)
- Specified by:
resolveStatein interfaceInitializer<EmbeddableInitializerImpl.EmbeddableInitializerData>
-
-