Package org.hibernate.sql.results.graph
Interface Initializer
-
- All Known Subinterfaces:
AggregateEmbeddableInitializer,CollectionInitializer,EmbeddableInitializer,EntityInitializer,FetchParentAccess
- All Known Implementing Classes:
AbstractBatchEntitySelectFetchInitializer,AbstractCollectionInitializer,AbstractEmbeddableInitializer,AbstractEntityInitializer,AbstractFetchParentAccess,AbstractImmediateCollectionInitializer,AbstractNonAggregatedIdentifierMappingInitializer,AggregateEmbeddableFetchInitializer,AggregateEmbeddableResultInitializer,ArrayInitializer,BagInitializer,BatchEntityInsideEmbeddableSelectFetchInitializer,BatchEntitySelectFetchInitializer,BatchInitializeEntitySelectFetchInitializer,DelayedCollectionInitializer,DiscriminatedEntityInitializer,EmbeddableFetchInitializer,EmbeddableResultInitializer,EntityDelayedFetchInitializer,EntityJoinedFetchInitializer,EntityResultInitializer,EntitySelectFetchByUniqueKeyInitializer,EntitySelectFetchInitializer,ListInitializer,MapInitializer,NonAggregatedIdentifierMappingFetchInitializer,NonAggregatedIdentifierMappingResultInitializer,SelectEagerCollectionInitializer,SetInitializer
@Incubating public interface Initializer
Defines a multi-step process for initializing entity, collection and composite state. Each step is performed on each initializer before starting the next step.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default @Nullable CollectionInitializerasCollectionInitializer()A utility method to avoid casting explicitly to CollectionInitializerdefault @Nullable EmbeddableInitializerasEmbeddableInitializer()A utility method to avoid casting explicitly to EmbeddableInitializerdefault @Nullable EntityInitializerasEntityInitializer()A utility method to avoid casting explicitly to EntityInitializerdefault voidendLoading(ExecutionContext executionContext)Lifecycle method called at the very end of the result values processingvoidfinishUpRow(RowProcessingState rowProcessingState)Lifecycle method called at the end of the current row processing.ObjectgetInitializedInstance()ModelPartgetInitializedPart()NavigablePathgetNavigablePath()voidinitializeInstance(RowProcessingState rowProcessingState)Step 3 - Initialize the state of the instance resolved inresolveInstance(org.hibernate.sql.results.jdbc.spi.RowProcessingState)from the current row values.default voidinitializeInstanceFromParent(Object parentInstance, RowProcessingState rowProcessingState)Step 3.1 - Initialize the state of the instance as extracted from the given parentInstance.default booleanisCollectionInitializer()default booleanisEmbeddableInitializer()default booleanisEntityInitializer()booleanisPartOfKey()static booleanisPartOfKey(NavigablePath navigablePath, FetchParentAccess parentAccess)booleanisResultInitializer()default voidmarkShallowCached()voidresolveInstance(RowProcessingState rowProcessingState)Step 2 - Using the key resolved inresolveKey(org.hibernate.sql.results.jdbc.spi.RowProcessingState), resolve the instance (of the thing initialized) to use for the current row.voidresolveKey(RowProcessingState rowProcessingState)Step 1 - Resolve the key value for this initializer for the current row.default voidstartLoading(RowProcessingState rowProcessingState)
-
-
-
Method Detail
-
getNavigablePath
NavigablePath getNavigablePath()
-
getInitializedPart
ModelPart getInitializedPart()
-
getInitializedInstance
Object getInitializedInstance()
-
startLoading
default void startLoading(RowProcessingState rowProcessingState)
-
markShallowCached
default void markShallowCached()
-
resolveKey
void resolveKey(RowProcessingState rowProcessingState)
Step 1 - Resolve the key value for this initializer for the current row. After this point, the initializer knows the entity/collection/component key for the current row
-
resolveInstance
void resolveInstance(RowProcessingState rowProcessingState)
Step 2 - Using the key resolved inresolveKey(org.hibernate.sql.results.jdbc.spi.RowProcessingState), 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
-
initializeInstance
void initializeInstance(RowProcessingState rowProcessingState)
Step 3 - Initialize the state of the instance resolved inresolveInstance(org.hibernate.sql.results.jdbc.spi.RowProcessingState)from the current row values. All resolved state for the current row is injected into the resolved instance
-
initializeInstanceFromParent
default void initializeInstanceFromParent(Object parentInstance, RowProcessingState rowProcessingState)
Step 3.1 - Initialize the state of the instance as extracted from the given parentInstance. 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 theJdbcValuesCacheHitto initialize potentially lazy associations.
-
finishUpRow
void finishUpRow(RowProcessingState rowProcessingState)
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
default void endLoading(ExecutionContext executionContext)
Lifecycle method called at the very end of the result values processing
-
isPartOfKey
boolean isPartOfKey()
-
isPartOfKey
static boolean isPartOfKey(NavigablePath navigablePath, FetchParentAccess parentAccess)
-
isResultInitializer
boolean isResultInitializer()
-
isEmbeddableInitializer
default boolean isEmbeddableInitializer()
-
isEntityInitializer
default boolean isEntityInitializer()
-
isCollectionInitializer
default boolean isCollectionInitializer()
-
asEntityInitializer
default @Nullable EntityInitializer asEntityInitializer()
A utility method to avoid casting explicitly to EntityInitializer- Returns:
- EntityInitializer if this is an instance of EntityInitializer otherwise
null
-
asEmbeddableInitializer
default @Nullable EmbeddableInitializer asEmbeddableInitializer()
A utility method to avoid casting explicitly to EmbeddableInitializer- Returns:
- EmbeddableInitializer if this is an instance of EmbeddableInitializer otherwise
null
-
asCollectionInitializer
default @Nullable CollectionInitializer asCollectionInitializer()
A utility method to avoid casting explicitly to CollectionInitializer- Returns:
- CollectionInitializer if this is an instance of CollectionInitializer otherwise
null
-
-