Top Description Fields Constructors Methods
org.hibernate.sql.results.graph.collection.internal

public abstract Class AbstractImmediateCollectionInitializer

extends AbstractCollectionInitializer
Class Inheritance
Known Direct Subclasses
org.hibernate.sql.results.graph.collection.internal.ArrayInitializer, org.hibernate.sql.results.graph.collection.internal.BagInitializer, org.hibernate.sql.results.graph.collection.internal.ListInitializer, org.hibernate.sql.results.graph.collection.internal.MapInitializer, org.hibernate.sql.results.graph.collection.internal.SetInitializer
Imports
java.util.List, org.hibernate.LockMode, org.hibernate.collection.spi.CollectionSemantics, .PersistentCollection, org.hibernate.engine.spi.CollectionKey, .PersistenceContext, .SharedSessionContractImplementor, org.hibernate.internal.log.LoggingHelper, org.hibernate.metamodel.mapping.PluralAttributeMapping, org.hibernate.persister.collection.CollectionPersister, org.hibernate.spi.NavigablePath, org.hibernate.sql.results.graph.DomainResultAssembler, .FetchParentAccess, org.hibernate.sql.results.graph.collection.CollectionLoadingLogger, .LoadingCollectionEntry, org.hibernate.sql.results.internal.LoadingCollectionEntryImpl, org.hibernate.sql.results.jdbc.spi.RowProcessingState

Base support for CollectionInitializer implementations that represent an immediate initialization of some sort (join, select, batch, sub-select) for a persistent collection.

Implementation Note

Mainly an intention contract wrt the immediacy of the fetch.

Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private Object
private final DomainResultAssembler<?>
collectionValueKeyResultAssembler

refers to the rows entry in the collection.

private boolean
private LoadingCollectionEntryImpl
Inherited from org.hibernate.sql.results.graph.collection.internal.AbstractCollectionInitializer:
collectionAttributeMappingcollectionInstancecollectionKeycollectionKeyResultAssemblerparentAccess

Constructor Summary

AccessConstructor and Description
public
AbstractImmediateCollectionInitializer(NavigablePath collectionPath, PluralAttributeMapping collectionAttributeMapping, FetchParentAccess parentAccess, LockMode lockMode, DomainResultAssembler<?> collectionKeyResultAssembler, DomainResultAssembler<?> collectionValueKeyResultAssembler)

Method Summary

Modifier and TypeMethod and Description
public void
protected Object
getCollectionValueKey()

The value of the collection side of the collection key (FK).

protected abstract String
public void
initializeInstance(RowProcessingState rowProcessingState)

Implements org.hibernate.sql.results.graph.Initializer.initializeInstance.

Step 3 - Initialize the state of the instance resolved in resolveInstance from the current row values.
protected abstract void
readCollectionRow(CollectionKey collectionKey, List<Object> loadingState, RowProcessingState rowProcessingState)

public void
resolveInstance(RowProcessingState rowProcessingState)

Implements org.hibernate.sql.results.graph.Initializer.resolveInstance.

Step 2 - Using the key resolved in resolveKey, resolve the instance (of the thing initialized) to use for the current row.
public void
resolveKey(RowProcessingState rowProcessingState)

Overrides org.hibernate.sql.results.graph.collection.internal.AbstractCollectionInitializer.resolveKey.

Implements org.hibernate.sql.results.graph.Initializer.resolveKey.

Step 1 - Resolve the key value for this initializer for the current row.
protected void
takeResponsibility(RowProcessingState rowProcessingState, CollectionKey collectionKey)

private String
toLoggableString(PersistentCollection<?> collectionInstance)

Specialized toString handling for PersistentCollection.

Inherited from org.hibernate.sql.results.graph.collection.internal.AbstractCollectionInitializer:
getCollectionAttributeMappinggetCollectionInstancegetInitializedPartgetNavigablePathgetParentAccessresolveCollectionKeyresolveInstance

Field Detail

collectionValueKeyback to summary
private Object collectionValueKey
collectionValueKeyResultAssemblerback to summary
private final DomainResultAssembler<?> collectionValueKeyResultAssembler

refers to the rows entry in the collection. null indicates that the collection is empty

isInitializedback to summary
private boolean isInitialized
responsibilityback to summary
private LoadingCollectionEntryImpl responsibility

Constructor Detail

AbstractImmediateCollectionInitializerback to summary
public AbstractImmediateCollectionInitializer(NavigablePath collectionPath, PluralAttributeMapping collectionAttributeMapping, FetchParentAccess parentAccess, LockMode lockMode, DomainResultAssembler<?> collectionKeyResultAssembler, DomainResultAssembler<?> collectionValueKeyResultAssembler)

Method Detail

finishUpRowback to summary
public void finishUpRow(RowProcessingState rowProcessingState)

Overrides org.hibernate.sql.results.graph.collection.internal.AbstractCollectionInitializer.finishUpRow.

Implements org.hibernate.sql.results.graph.Initializer.finishUpRow.

Doc from org.hibernate.sql.results.graph.Initializer.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.

Annotations
@Override
getCollectionValueKeyback to summary
protected Object getCollectionValueKey()

The value of the collection side of the collection key (FK). Identifies inclusion in the collection. Can be null to indicate that the current row does not contain any collection values

getSimpleConcreteImplNameback to summary
protected abstract String getSimpleConcreteImplName()
initializeInstanceback to summary
public void initializeInstance(RowProcessingState rowProcessingState)

Implements org.hibernate.sql.results.graph.Initializer.initializeInstance.

Doc from org.hibernate.sql.results.graph.Initializer.initializeInstance.

Step 3 - Initialize the state of the instance resolved in resolveInstance from the current row values. All resolved state for the current row is injected into the resolved instance

Annotations
@Override
readCollectionRowback to summary
protected abstract void readCollectionRow(CollectionKey collectionKey, List<Object> loadingState, RowProcessingState rowProcessingState)
resolveInstanceback to summary
public void resolveInstance(RowProcessingState rowProcessingState)

Implements org.hibernate.sql.results.graph.Initializer.resolveInstance.

Doc from org.hibernate.sql.results.graph.Initializer.resolveInstance.

Step 2 - Using the key resolved in resolveKey, 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 todo (6.0) : much of the various implementations of this are similar enough to handle in a common base implementation (templating?) things like resolving as managed (Session cache), from second-level cache, from LoadContext, etc..

Annotations
@Override
resolveKeyback to summary
public void resolveKey(RowProcessingState rowProcessingState)

Overrides org.hibernate.sql.results.graph.collection.internal.AbstractCollectionInitializer.resolveKey.

Implements org.hibernate.sql.results.graph.Initializer.resolveKey.

Doc from org.hibernate.sql.results.graph.Initializer.resolveKey.

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

Annotations
@Override
takeResponsibilityback to summary
protected void takeResponsibility(RowProcessingState rowProcessingState, CollectionKey collectionKey)
toLoggableStringback to summary
private String toLoggableString(PersistentCollection<?> collectionInstance)

Specialized toString handling for PersistentCollection. All `PersistentCollection#toString` implementations are crazy expensive as they trigger a load