Top Description Methods
org.hibernate.collection.spi

public Interface CollectionSemantics<CE, E>

Known Direct Subinterfaces
org.hibernate.collection.spi.MapSemantics, org.hibernate.collection.spi.BagSemantics
Known Direct Implementers
org.hibernate.collection.internal.CustomCollectionTypeSemantics, org.hibernate.collection.internal.StandardArraySemantics, org.hibernate.collection.internal.StandardListSemantics, org.hibernate.collection.spi.AbstractSetSemantics
Annotations
@Incubating
Type Parameters
<CE>
the type of the collection
<E>
the collection element or map key type
Imports
java.util.Iterator, java.util.function.Consumer, org.hibernate.Incubating, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.metamodel.CollectionClassification, org.hibernate.metamodel.mapping.PluralAttributeMapping, org.hibernate.persister.collection.CollectionPersister, org.hibernate.spi.NavigablePath, org.hibernate.sql.results.graph.DomainResultCreationState, .Fetch, .FetchParent

Each instance of this interface describes the semantics of some sort of persistent collection so that Hibernate understands how to manage the lifecycle of instances of that sort of collection.

A collection type with semantics described by a CollectionSemantics object need not be part of the Java Collections Framework.

Authors
Steve Ebersole, Gavin King
Since
6.0

Method Summary

Modifier and TypeMethod and Description
public default CollectionInitializerProducer
createInitializerProducer(NavigablePath navigablePath, PluralAttributeMapping attributeMapping, FetchParent fetchParent, boolean selected, String resultVariable, DomainResultCreationState creationState)

Create a producer for org.hibernate.sql.results.graph.collection.CollectionInitializer instances for the given collection semantics

public default CollectionInitializerProducer
createInitializerProducer(NavigablePath navigablePath, PluralAttributeMapping attributeMapping, FetchParent fetchParent, boolean selected, String resultVariable, Fetch indexFetch, Fetch elementFetch, DomainResultCreationState creationState)

Create a producer for org.hibernate.sql.results.graph.collection.CollectionInitializer instances for the given collection semantics

public CollectionClassification
getCollectionClassification()

The classification handled by this semantic

public Class<?>
getCollectionJavaType()

The collection's Java type

public Iterator<E>
getElementIterator(CE rawCollection)

Obtain an iterator over the collection elements

public CE
instantiateRaw(int anticipatedSize, CollectionPersister collectionDescriptor)

Create a raw (unwrapped) version of the collection

public PersistentCollection<E>
instantiateWrapper(Object key, CollectionPersister collectionDescriptor, SharedSessionContractImplementor session)

Create a wrapper for the collection

public void
visitElements(CE rawCollection, Consumer<? super E> action)

Visit the elements of the collection

public PersistentCollection<E>
wrap(CE rawCollection, CollectionPersister collectionDescriptor, SharedSessionContractImplementor session)

Wrap a raw collection in wrapper

Method Detail

createInitializerProducerback to summary
public default CollectionInitializerProducer createInitializerProducer(NavigablePath navigablePath, PluralAttributeMapping attributeMapping, FetchParent fetchParent, boolean selected, String resultVariable, DomainResultCreationState creationState)

Create a producer for org.hibernate.sql.results.graph.collection.CollectionInitializer instances for the given collection semantics

See Also
InitializerProducerBuilder
createInitializerProducerback to summary
public default CollectionInitializerProducer createInitializerProducer(NavigablePath navigablePath, PluralAttributeMapping attributeMapping, FetchParent fetchParent, boolean selected, String resultVariable, Fetch indexFetch, Fetch elementFetch, DomainResultCreationState creationState)

Create a producer for org.hibernate.sql.results.graph.collection.CollectionInitializer instances for the given collection semantics

See Also
InitializerProducerBuilder
getCollectionClassificationback to summary
public CollectionClassification getCollectionClassification()

The classification handled by this semantic

getCollectionJavaTypeback to summary
public Class<?> getCollectionJavaType()

The collection's Java type

getElementIteratorback to summary
public Iterator<E> getElementIterator(CE rawCollection)

Obtain an iterator over the collection elements

instantiateRawback to summary
public CE instantiateRaw(int anticipatedSize, CollectionPersister collectionDescriptor)

Create a raw (unwrapped) version of the collection

instantiateWrapperback to summary
public PersistentCollection<E> instantiateWrapper(Object key, CollectionPersister collectionDescriptor, SharedSessionContractImplementor session)

Create a wrapper for the collection

visitElementsback to summary
public void visitElements(CE rawCollection, Consumer<? super E> action)

Visit the elements of the collection

wrapback to summary
public PersistentCollection<E> wrap(CE rawCollection, CollectionPersister collectionDescriptor, SharedSessionContractImplementor session)

Wrap a raw collection in wrapper