Class DiscriminatedEntityInitializer
- java.lang.Object
-
- org.hibernate.sql.results.graph.internal.AbstractInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
- org.hibernate.sql.results.graph.entity.internal.DiscriminatedEntityInitializer
-
- All Implemented Interfaces:
EntityInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
,Initializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
,InitializerParent<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
public class DiscriminatedEntityInitializer extends AbstractInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData> implements EntityInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
Initializer for discriminated mappings.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData
-
Nested classes/interfaces inherited from interface org.hibernate.sql.results.graph.Initializer
Initializer.State
-
-
Field Summary
Fields Modifier and Type Field Description protected InitializerParent<?>
parent
-
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 DiscriminatedEntityInitializer(InitializerParent<?> parent, DiscriminatedAssociationModelPart fetchedPart, NavigablePath fetchedNavigable, Fetch discriminatorFetch, Fetch keyFetch, boolean eager, boolean resultInitializer, 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(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData data)
EntityPersister
getEntityDescriptor()
Get the descriptor for the type of entity being initialized@Nullable Object
getEntityIdentifier(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData data)
ModelPart
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(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData data)
Step 3 - Initialize the state of the instance resolved inInitializer.resolveInstance(Data)
from the current row values.void
initializeInstanceFromParent(Object parentInstance, DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData 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(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData 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(Object instance, DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData data)
Step 2.2 - Use the given instance as resolved instance for this initializer.void
resolveInstance(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData 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(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData data)
Step 1.1 - Resolve the key value for this initializer for the current row and then recurse to the sub-initializers.void
resolveState(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData 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.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, resolveState, startLoading
-
-
-
-
Field Detail
-
parent
protected final InitializerParent<?> parent
-
-
Constructor Detail
-
DiscriminatedEntityInitializer
public DiscriminatedEntityInitializer(InitializerParent<?> parent, DiscriminatedAssociationModelPart fetchedPart, NavigablePath fetchedNavigable, Fetch discriminatorFetch, Fetch keyFetch, boolean eager, boolean resultInitializer, AssemblerCreationState creationState)
-
-
Method Detail
-
createInitializerData
protected InitializerData createInitializerData(RowProcessingState rowProcessingState)
-
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<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
getInitializedPart
public ModelPart getInitializedPart()
- Specified by:
getInitializedPart
in interfaceInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
getNavigablePath
public NavigablePath getNavigablePath()
- Specified by:
getNavigablePath
in interfaceInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
resolveKey
public void resolveKey(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData 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<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
- Overrides:
resolveKey
in classAbstractInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
resolveState
public void resolveState(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData data)
- Specified by:
resolveState
in interfaceInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
resolveFromPreviousRow
public void resolveFromPreviousRow(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData 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<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
resolveInstance
public void resolveInstance(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData 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<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
resolveInstance
public void resolveInstance(Object instance, DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData 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<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
initializeInstance
public void initializeInstance(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData 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<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
- Overrides:
initializeInstance
in classAbstractInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
initializeInstanceFromParent
public void initializeInstanceFromParent(Object parentInstance, DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData 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<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
forEachSubInitializer
protected void forEachSubInitializer(BiConsumer<Initializer<?>,RowProcessingState> consumer, InitializerData data)
-
getEntityDescriptor
public EntityPersister getEntityDescriptor()
Description copied from interface:EntityInitializer
Get the descriptor for the type of entity being initialized- Specified by:
getEntityDescriptor
in interfaceEntityInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
getConcreteDescriptor
public EntityPersister getConcreteDescriptor(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData data)
- Specified by:
getConcreteDescriptor
in interfaceEntityInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
getEntityIdentifier
public @Nullable Object getEntityIdentifier(DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData data)
- Specified by:
getEntityIdentifier
in interfaceEntityInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
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<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
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<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
hasLazySubInitializers
public boolean hasLazySubInitializers()
Description copied from interface:Initializer
Indicates whether this initializer has sub-initializers which are lazy.- Specified by:
hasLazySubInitializers
in interfaceInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
isResultInitializer
public boolean isResultInitializer()
Description copied from interface:Initializer
Indicates if this is a result or fetch initializer.- Specified by:
isResultInitializer
in interfaceInitializer<DiscriminatedEntityInitializer.DiscriminatedEntityInitializerData>
-
-