Top Description Fields Constructors Methods
org.hibernate.metamodel.mapping.internal

public Class OneToManyCollectionPart

extends AbstractEntityCollectionPart
implements TableGroupJoinProducer
Class Inheritance
All Implemented Interfaces
org.hibernate.sql.ast.tree.from.TableGroupJoinProducer, org.hibernate.sql.ast.tree.from.TableGroupProducer, org.hibernate.metamodel.mapping.ModelPartContainer, org.hibernate.metamodel.mapping.ModelPart, org.hibernate.metamodel.mapping.MappingModelExpressible, org.hibernate.metamodel.mapping.Bindable, org.hibernate.metamodel.mapping.JdbcMappingContainer
Imports
java.util.function.Consumer, org.hibernate.annotations.NotFoundAction, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.mapping.Collection, .Map, org.hibernate.metamodel.mapping.AssociationKey, .AttributeMapping, .EntityMappingType, .ForeignKeyDescriptor, .JdbcMapping, .PluralAttributeMapping, .SelectableConsumer, .SelectableMapping, org.hibernate.persister.collection.CollectionPersister, org.hibernate.spi.NavigablePath, org.hibernate.sql.ast.SqlAstJoinType, org.hibernate.sql.ast.spi.SqlAliasBase, .SqlAstCreationState, org.hibernate.sql.ast.tree.from.OneToManyTableGroup, .TableGroup, .TableGroupJoin, .TableGroupJoinProducer, org.hibernate.sql.ast.tree.predicate.Predicate

order( id, ... ) item( id, order_fk, ... ) `Order#items` table : item key : order_fk element : id
Author
Steve Ebersole

Field Summary

Modifier and TypeField and Description
private AssociationKey
private final String

Constructor Summary

AccessConstructor and Description
public
OneToManyCollectionPart(CollectionPart.Nature nature, Collection bootCollectionDescriptor, CollectionPersister collectionDescriptor, EntityMappingType elementTypeDescriptor, MappingModelCreationProcess creationProcess)

public
OneToManyCollectionPart(CollectionPart.Nature nature, Collection bootCollectionDescriptor, CollectionPersister collectionDescriptor, EntityMappingType elementTypeDescriptor, NotFoundAction notFoundAction, MappingModelCreationProcess creationProcess)

protected
OneToManyCollectionPart(OneToManyCollectionPart original)

For Hibernate Reactive

Method Summary

Modifier and TypeMethod and Description
public <X, Y> int
breakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X, Y> valueConsumer, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.ModelPart.breakDownJdbcValues.

Breaks down the domain value to its constituent JDBC values.
public boolean
public TableGroup
createAssociatedTableGroup(boolean canUseInnerJoins, NavigablePath append, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlAstCreationState creationState)

public TableGroup
createRootTableGroupJoin(NavigablePath
The NavigablePath to the join
navigablePath
,
TableGroup
The join's (L)eft-(H)and (S)ide
lhs
,
String explicitSourceAlias, SqlAliasBase
A specific SqlAliasBase to use. May be null indicating one should be created using the SqlAliasBaseGenerator from creationState
explicitSqlAliasBase
,
SqlAstJoinType
An explicit join-type. May be null to signal that the join is for an implicit path.
sqlAstJoinType
,
boolean fetched, Consumer<Predicate>
Consumer for additional predicates from the producer's mapping.
predicateConsumer
,
SqlAstCreationState creationState)

Implements org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.createRootTableGroupJoin.

Create the "join", but return a TableGroup.
public TableGroupJoin
createTableGroupJoin(NavigablePath
The NavigablePath to the join
navigablePath
,
TableGroup
The join's (L)eft-(H)and (S)ide
lhs
,
String explicitSourceAlias, SqlAliasBase
A specific SqlAliasBase to use. May be null indicating one should be created using the SqlAliasBaseGenerator from creationState
explicitSqlAliasBase
,
SqlAstJoinType
An explicit join-type. May be null to signal that the join is for an implicit path.
requestedJoinType
,
boolean fetched, boolean
Indicates there are explicit, additional predicates (from an SQM tree ON/WITH clause)
addsPredicate
,
SqlAstCreationState creationState)

Implements org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.createTableGroupJoin.

Create a TableGroupJoin.
public boolean
finishInitialization(CollectionPersister collectionDescriptor, Collection bootValueMapping, String fkTargetModelPartName, MappingModelCreationProcess creationProcess)

Implements org.hibernate.metamodel.mapping.internal.EntityCollectionPart.finishInitialization.

Perform any delayed initialization.
public int
forEachSelectable(int offset, SelectableConsumer consumer)

Overrides default org.hibernate.metamodel.mapping.ModelPart.forEachSelectable, org.hibernate.metamodel.mapping.ValuedModelPart.forEachSelectable.

Visits each selectable mapping with the selectable index offset by the given value.
public EntityCollectionPart.Cardinality
public String
getContainingTableExpression()

Implements org.hibernate.metamodel.mapping.ValuedModelPart.getContainingTableExpression.

The table which contains the columns mapped by this value
public SqlAstJoinType
public JdbcMapping
public SelectableMapping
getSelectable(int columnIndex)

Implements org.hibernate.metamodel.mapping.SelectableMappings.getSelectable.

Get the selectable at the given position
public boolean
public boolean
isSimpleJoinPredicate(Predicate predicate)

Implements org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.isSimpleJoinPredicate.

Returns whether the given predicate is a simple join predicate for this attribute.
protected AssociationKey
Inherited from org.hibernate.metamodel.mapping.internal.AbstractEntityCollectionPart:
buildEagerCollectionFetchbuildEntityFetchJoinedcreateDomainResultcreateTableGroupInternaldisassemblefindContainingEntityMappinggenerateFetchgetAssociatedEntityMappingTypegetCollectionDescriptorgetFetchableKeygetFetchableNamegetMappedFetchOptionsgetMappedTypegetNaturegetNavigableRolegetNotFoundActiongetNumberOfFetchablesgetSqlAliasStemgetStylegetTargetKeyPropertyNamesgetTimingincrementFetchDepthisOptionalisUnwrapProxytoString

Field Detail

fetchAssociationKeyback to summary
private AssociationKey fetchAssociationKey
mapKeyPropertyNameback to summary
private final String mapKeyPropertyName

Constructor Detail

OneToManyCollectionPartback to summary
public OneToManyCollectionPart(CollectionPart.Nature nature, Collection bootCollectionDescriptor, CollectionPersister collectionDescriptor, EntityMappingType elementTypeDescriptor, MappingModelCreationProcess creationProcess)
OneToManyCollectionPartback to summary
public OneToManyCollectionPart(CollectionPart.Nature nature, Collection bootCollectionDescriptor, CollectionPersister collectionDescriptor, EntityMappingType elementTypeDescriptor, NotFoundAction notFoundAction, MappingModelCreationProcess creationProcess)
OneToManyCollectionPartback to summary
protected OneToManyCollectionPart(OneToManyCollectionPart original)

For Hibernate Reactive

Method Detail

breakDownJdbcValuesback to summary
public <X, Y> int breakDownJdbcValues(Object domainValue, int offset, X x, Y y, ModelPart.JdbcValueBiConsumer<X, Y> valueConsumer, SharedSessionContractImplementor session)

Implements org.hibernate.metamodel.mapping.ModelPart.breakDownJdbcValues.

Doc from org.hibernate.metamodel.mapping.ModelPart.breakDownJdbcValues.

Breaks down the domain value to its constituent JDBC values. Think of it as breaking the multi-dimensional array into a visitable flat array. Additionally, it passes through the values X and Y to the consumer. Returns the amount of jdbc types that have been visited.

Annotations
@Override
containsTableReferenceback to summary
public boolean containsTableReference(String tableExpression)

Overrides org.hibernate.metamodel.mapping.internal.AbstractEntityCollectionPart.containsTableReference.

Overrides default org.hibernate.sql.ast.tree.from.TableGroupProducer.containsTableReference.

Annotations
@Override
createAssociatedTableGroupback to summary
public TableGroup createAssociatedTableGroup(boolean canUseInnerJoins, NavigablePath append, boolean fetched, String sourceAlias, SqlAliasBase sqlAliasBase, SqlAstCreationState creationState)
createRootTableGroupJoinback to summary
public TableGroup createRootTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, String explicitSourceAlias, SqlAliasBase explicitSqlAliasBase, SqlAstJoinType sqlAstJoinType, boolean fetched, Consumer<Predicate> predicateConsumer, SqlAstCreationState creationState)

Implements org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.createRootTableGroupJoin.

Doc from org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.createRootTableGroupJoin.

Create the "join", but return a TableGroup. Intended for creating sub-query correlations. E.g., given

    from SomeEntity e
    where exists (
        select 1
        from AnotherEntity a
        where e.association.attr = 1
    )
We call this for the `e.association` path.
Parameters
navigablePath:NavigablePath

The NavigablePath to the join

lhs:TableGroup

The join's (L)eft-(H)and (S)ide

explicitSqlAliasBase:SqlAliasBase

A specific SqlAliasBase to use. May be null indicating one should be created using the SqlAliasBaseGenerator from creationState

sqlAstJoinType:SqlAstJoinType

An explicit join-type. May be null to signal that the join is for an implicit path.

predicateConsumer:Consumer<Predicate>

Consumer for additional predicates from the producer's mapping.

Annotations
@Override
createTableGroupJoinback to summary
public TableGroupJoin createTableGroupJoin(NavigablePath navigablePath, TableGroup lhs, String explicitSourceAlias, SqlAliasBase explicitSqlAliasBase, SqlAstJoinType requestedJoinType, boolean fetched, boolean addsPredicate, SqlAstCreationState creationState)

Implements org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.createTableGroupJoin.

Doc from org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.createTableGroupJoin.

Create a TableGroupJoin.

Parameters
navigablePath:NavigablePath

The NavigablePath to the join

lhs:TableGroup

The join's (L)eft-(H)and (S)ide

explicitSqlAliasBase:SqlAliasBase

A specific SqlAliasBase to use. May be null indicating one should be created using the SqlAliasBaseGenerator from creationState

requestedJoinType:SqlAstJoinType

An explicit join-type. May be null to signal that the join is for an implicit path.

addsPredicate:boolean

Indicates there are explicit, additional predicates (from an SQM tree ON/WITH clause)

Annotations
@Override
finishInitializationback to summary
public boolean finishInitialization(CollectionPersister collectionDescriptor, Collection bootValueMapping, String fkTargetModelPartName, MappingModelCreationProcess creationProcess)

Implements org.hibernate.metamodel.mapping.internal.EntityCollectionPart.finishInitialization.

Doc from org.hibernate.metamodel.mapping.internal.EntityCollectionPart.finishInitialization.

Perform any delayed initialization.

The initialization is considered successful if the result is true. It is considered unsuccessful if the result is false or an exception is thrown. Unsuccessful initializations are generally retried "later", to allow waiting for model-parts being available e.g.

If the exception is something that will just never succeed, consider throwing an exception with the NonTransientException marker to allow the creation process to stop immediately

Annotations
@Override
forEachSelectableback to summary
public int forEachSelectable(int offset, SelectableConsumer consumer)

Overrides default org.hibernate.metamodel.mapping.ModelPart.forEachSelectable, org.hibernate.metamodel.mapping.ValuedModelPart.forEachSelectable.

Doc from org.hibernate.metamodel.mapping.ModelPart.forEachSelectable.

Visits each selectable mapping with the selectable index offset by the given value. Returns the amount of jdbc types that have been visited.

Annotations
@Override
getCardinalityback to summary
public EntityCollectionPart.Cardinality getCardinality()

Implements org.hibernate.metamodel.mapping.internal.EntityCollectionPart.getCardinality.

Annotations
@Override
getContainingTableExpressionback to summary
public String getContainingTableExpression()

Implements org.hibernate.metamodel.mapping.ValuedModelPart.getContainingTableExpression.

Doc from org.hibernate.metamodel.mapping.ValuedModelPart.getContainingTableExpression.

The table which contains the columns mapped by this value

Annotations
@Override
getDefaultSqlAstJoinTypeback to summary
public SqlAstJoinType getDefaultSqlAstJoinType(TableGroup parentTableGroup)

Implements org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.getDefaultSqlAstJoinType.

Annotations
@Override
getJdbcMappingback to summary
public JdbcMapping getJdbcMapping(final int index)

Implements org.hibernate.metamodel.mapping.JdbcMappingContainer.getJdbcMapping.

Annotations
@Override
getSelectableback to summary
public SelectableMapping getSelectable(int columnIndex)

Implements org.hibernate.metamodel.mapping.SelectableMappings.getSelectable.

Doc from org.hibernate.metamodel.mapping.SelectableMappings.getSelectable.

Get the selectable at the given position

Annotations
@Override
hasPartitionedSelectionMappingback to summary
public boolean hasPartitionedSelectionMapping()

Implements org.hibernate.metamodel.mapping.ModelPart.hasPartitionedSelectionMapping.

Annotations
@Override
isSimpleJoinPredicateback to summary
public boolean isSimpleJoinPredicate(Predicate predicate)

Implements org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.isSimpleJoinPredicate.

Doc from org.hibernate.sql.ast.tree.from.TableGroupJoinProducer.isSimpleJoinPredicate.

Returns whether the given predicate is a simple join predicate for this attribute. This is useful to understand if a predicate has additional conjunctions other than the FK related predicate.

Annotations
@Override
resolveFetchAssociationKeyback to summary
protected AssociationKey resolveFetchAssociationKey()

Implements abstract org.hibernate.metamodel.mapping.internal.AbstractEntityCollectionPart.resolveFetchAssociationKey.

Annotations
@Override