Interface Initializer<Data extends InitializerData>
- All Known Subinterfaces:
CollectionInitializer<Data>,EmbeddableInitializer<Data>,EntityInitializer<Data>,InitializerParent<Data>
- All Known Implementing Classes:
AbstractBatchEntitySelectFetchInitializer,AbstractCollectionInitializer,AbstractImmediateCollectionInitializer,AbstractInitializer,AbstractNonJoinCollectionInitializer,AggregateEmbeddableInitializerImpl,ArrayInitializer,BagInitializer,BatchEntityInsideEmbeddableSelectFetchInitializer,BatchEntitySelectFetchInitializer,BatchInitializeEntitySelectFetchInitializer,DelayedCollectionInitializer,DiscriminatedEntityInitializer,EmbeddableInitializerImpl,EntityDelayedFetchInitializer,EntityInitializerImpl,EntitySelectFetchByUniqueKeyInitializer,EntitySelectFetchInitializer,ListInitializer,MapInitializer,NonAggregatedIdentifierMappingInitializer,SelectEagerCollectionInitializer,SetInitializer
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault @Nullable CollectionInitializer<?> A utility method to avoid casting explicitly to CollectionInitializerdefault @Nullable EmbeddableInitializer<?> A utility method to avoid casting explicitly to EmbeddableInitializerdefault @Nullable EntityInitializer<?> A utility method to avoid casting explicitly to EntityInitializerdefault voidendLoading(Data data) Lifecycle method called at the very end of the result values processingdefault @Nullable EntityInitializer<?> Find the entity initializer that owns this initializer by traversing upgetParent().static @Nullable EntityInitializer<?> findOwningEntityInitializer(@Nullable Initializer<?> parent) Find the entity initializer that owns this initializer by traversing upgetParent().voidfinishUpRow(Data data) Lifecycle method called at the end of the current row processing.getData(RowProcessingState rowProcessingState) The current data of this initializer.default @Nullable InitializerParent<?> Returns the parentInitializerornullif this is a result initializer.default ObjectgetResolvedInstance(Data data) default ObjectgetResolvedInstance(RowProcessingState rowProcessingState) booleanIndicates whether this initializer has sub-initializers which are lazy.voidinitializeInstance(Data data) Step 3 - Initialize the state of the instance resolved inresolveInstance(Data)from the current row values.default voidinitializeInstance(RowProcessingState rowProcessingState) default voidinitializeInstanceFromParent(Object parentInstance, Data data) Step 3.1 - Initialize the state of the instance as extracted from the givenparentInstance.default voidinitializeInstanceFromParent(Object parentInstance, RowProcessingState rowProcessingState) default booleanbooleanisEager()Indicates whether calling resolve is needed when the object for this initializer is initialized already.default booleandefault booleandefault booleanIndicates whether this initializer or one of its sub-parts could be made lazy.booleanIndicates whether this initializer is part of a key i.e.static booleanisPartOfKey(NavigablePath navigablePath, InitializerParent<?> parent) booleanIndicates if this is a result or fetch initializer.default voidresolveFromPreviousRow(Data data) Step 1.2 - Special variant ofresolveKey(InitializerData)that allows the reuse of key value and instance value from the previous row.default voidresolveFromPreviousRow(RowProcessingState rowProcessingState) voidresolveInstance(Data data) Step 2.1 - Using the key resolved inresolveKey(Data), resolve the instance (of the thing initialized) to use for the current row.default voidresolveInstance(@Nullable Object instance, Data data) Step 2.2 - Use the given instance as resolved instance for this initializer.default voidresolveInstance(@Nullable Object instance, RowProcessingState rowProcessingState) default voidresolveInstance(RowProcessingState rowProcessingState) voidresolveKey(Data data) Step 1.1 - Resolve the key value for this initializer for the current row and then recurse to the sub-initializers.default voidresolveKey(RowProcessingState rowProcessingState) voidresolveState(Data data) default voidresolveState(RowProcessingState rowProcessingState) voidstartLoading(RowProcessingState rowProcessingState) Step 0 - Callback for initializers before the first row is read.
-
Field Details
-
EMPTY_ARRAY
-
-
Method Details
-
getParent
Returns the parentInitializerornullif this is a result initializer. -
findOwningEntityInitializer
Find the entity initializer that owns this initializer by traversing upgetParent(). -
findOwningEntityInitializer
Find the entity initializer that owns this initializer by traversing upgetParent(). -
getInitializedPart
ModelPart getInitializedPart() -
getResolvedInstance
-
getResolvedInstance
-
getData
The current data of this initializer. -
startLoading
Step 0 - Callback for initializers before the first row is read. It is the responsibility of this initializer to recurse to the sub-initializers and registerInitializerDatafor the initializer id viaRowProcessingState.setInitializerData(int, InitializerData).This is useful for e.g. preparing initializers in case of a cache hit.
-
resolveKey
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.
-
resolveKey
-
resolveFromPreviousRow
Step 1.2 - Special variant ofresolveKey(InitializerData)that allows the reuse of key value and instance value from the previous row.- Implementation Specification:
- Defaults to simply delegating to
resolveKey(InitializerData).
-
resolveFromPreviousRow
-
resolveInstance
Step 2.1 - Using the key resolved inresolveKey(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,
getResolvedInstance(RowProcessingState)will return that instance. -
resolveInstance
-
resolveState
-
resolveState
-
resolveInstance
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.
-
resolveInstance
-
initializeInstance
Step 3 - Initialize the state of the instance resolved inresolveInstance(Data)from the current row values.All resolved state for the current row is injected into the resolved instance
-
initializeInstance
-
initializeInstanceFromParent
Step 3.1 - Initialize the state of the instance as extracted from the givenparentInstance. Extraction can be done with thegetInitializedPart(). 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 the
JdbcValuesCacheHitto initialize potentially lazy associations. -
initializeInstanceFromParent
default void initializeInstanceFromParent(Object parentInstance, RowProcessingState rowProcessingState) -
finishUpRow
Lifecycle method called at the end of the current row processing. Provides ability to complete processing from the current row and prepare for the next row. -
endLoading
Lifecycle method called at the very end of the result values processing -
isPartOfKey
boolean isPartOfKey()Indicates whether this initializer is part of a key i.e. entity identifier, foreign key or collection key. -
isEager
boolean isEager()Indicates whether calling resolve is needed when the object for this initializer is initialized already. -
isLazyCapable
default boolean isLazyCapable()Indicates whether this initializer or one of its sub-parts could be made lazy. -
hasLazySubInitializers
boolean hasLazySubInitializers()Indicates whether this initializer has sub-initializers which are lazy. -
isResultInitializer
boolean isResultInitializer()Indicates if this is a result or fetch initializer. -
isEmbeddableInitializer
default boolean isEmbeddableInitializer() -
isEntityInitializer
default boolean isEntityInitializer() -
isCollectionInitializer
default boolean isCollectionInitializer() -
asEntityInitializer
A utility method to avoid casting explicitly to EntityInitializer- Returns:
- EntityInitializer if this is an instance of EntityInitializer otherwise
null
-
asEmbeddableInitializer
A utility method to avoid casting explicitly to EmbeddableInitializer- Returns:
- EmbeddableInitializer if this is an instance of EmbeddableInitializer otherwise
null
-
asCollectionInitializer
A utility method to avoid casting explicitly to CollectionInitializer- Returns:
- CollectionInitializer if this is an instance of CollectionInitializer otherwise
null
-