Top Description Fields Constructors Methods
org.hibernate.sql.ast.tree.from

public Class OneToManyTableGroup

extends AbstractColumnReferenceQualifier
implements TableGroup, PluralTableGroup
Class Inheritance
All Implemented Interfaces
org.hibernate.sql.ast.tree.from.PluralTableGroup, org.hibernate.sql.ast.tree.from.TableGroup, org.hibernate.query.sqm.sql.internal.DomainResultProducer, org.hibernate.query.sqm.sql.internal.SqmPathInterpretation, org.hibernate.sql.ast.tree.expression.Expression, org.hibernate.sql.ast.spi.SqlSelectionProducer, org.hibernate.sql.ast.tree.SqlAstNode, org.hibernate.sql.ast.tree.from.ColumnReferenceQualifier
Imports
java.util.List, java.util.function.Consumer, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.metamodel.mapping.PluralAttributeMapping, org.hibernate.spi.NavigablePath, org.hibernate.sql.results.graph.DomainResult, .DomainResultCreationState

A table group for one-to-many plural attributes. Delegates by default to the element table group, but also provides access to the index table group table references.
Author
Christian Beikov

Field Summary

Modifier and TypeField and Description
private final TableGroup
private TableGroup
private final PluralAttributeMapping
private final SessionFactoryImplementor
sessionFactory

Deprecated as a consequence of SessionFactoryImplementor being deprecated.

Constructor Summary

AccessConstructor and Description
public
OneToManyTableGroup(PluralAttributeMapping pluralAttributeMapping, TableGroup elementTableGroup, SessionFactoryImplementor sessionFactory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.

Method Summary

Modifier and TypeMethod and Description
public void
addNestedTableGroupJoin(TableGroupJoin join)

Implements org.hibernate.sql.ast.tree.from.TableGroup.addNestedTableGroupJoin.

A nested table group join is a join against a table group, that is ensured to be joined against the primary table reference and table reference joins in isolation, prior to doing other table group joins e.g. select * from entity1 e left join ( collection_table c1 join association a on a.id = c1.target_id ) on c1.entity_id = e.id and c1.key = 1 is modeled as TableGroup( primaryTableReference = TableReference(entity1, e), tableGroupJoins = [ TableGroupJoin( TableGroup( primaryTableReference = TableReference(collection_table, c1), nestedTableGroupJoins = [ TableGroupJoin( TableGroup( primaryTableReference = TableReference(association, a) ) ) ] ) ) ] ) This is necessary to correctly retain the cardinality of an HQL join like e.g. from Entity1 e left join e.collectionAssociation c on key(c) = 1
public void
public void
public void
applySqlSelections(DomainResultCreationState creationState)

Overrides default org.hibernate.sql.ast.tree.from.TableGroup.applySqlSelections.

Used when this producer is a selection in a sub-query.
public boolean
public DomainResult<J>
createDomainResult(String resultVariable, DomainResultCreationState creationState)

Overrides default org.hibernate.sql.ast.tree.from.TableGroup.createDomainResult.

Produce the domain query
public TableGroup
public PluralAttributeMapping
public String
getGroupAlias()

Implements org.hibernate.sql.ast.tree.from.TableGroup.getGroupAlias.

If we want to use CTE for TableGroup rendering we will need to know the alias we can use for the group
public TableGroup
public PluralAttributeMapping
public NavigablePath
public List<TableGroupJoin>
public TableReference
protected SessionFactoryImplementor
public String
public List<TableGroupJoin>
public TableReference
getTableReference(NavigablePath
The path for which to look up the table reference, may be null
navigablePath
,
String
The table expression for which to look up the table reference
tableExpression
,
boolean
Whether to potentially create table reference joins for this table group
resolve
)

Overrides org.hibernate.sql.ast.tree.from.AbstractColumnReferenceQualifier.getTableReference.

Implements org.hibernate.sql.ast.tree.from.ColumnReferenceQualifier.getTableReference.

Returns the table reference for the table expression, or null if not found.
public List<TableReferenceJoin>
public boolean
public boolean
public void
prependTableGroupJoin(NavigablePath navigablePath, TableGroupJoin join)

Implements org.hibernate.sql.ast.tree.from.TableGroup.prependTableGroupJoin.

Adds the given table group join before a join as found via the given navigable path.
public void
public void
public void

Field Detail

elementTableGroupback to summary
private final TableGroup elementTableGroup
indexTableGroupback to summary
private TableGroup indexTableGroup
pluralAttributeMappingback to summary
private final PluralAttributeMapping pluralAttributeMapping
sessionFactoryback to summary
private final SessionFactoryImplementor sessionFactory

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Constructor Detail

OneToManyTableGroupback to summary
public OneToManyTableGroup(PluralAttributeMapping pluralAttributeMapping, TableGroup elementTableGroup, SessionFactoryImplementor sessionFactory)

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Method Detail

addNestedTableGroupJoinback to summary
public void addNestedTableGroupJoin(TableGroupJoin join)

Implements org.hibernate.sql.ast.tree.from.TableGroup.addNestedTableGroupJoin.

Doc from org.hibernate.sql.ast.tree.from.TableGroup.addNestedTableGroupJoin.

A nested table group join is a join against a table group, that is ensured to be joined against the primary table reference and table reference joins in isolation, prior to doing other table group joins e.g. select * from entity1 e left join ( collection_table c1 join association a on a.id = c1.target_id ) on c1.entity_id = e.id and c1.key = 1 is modeled as TableGroup( primaryTableReference = TableReference(entity1, e), tableGroupJoins = [ TableGroupJoin( TableGroup( primaryTableReference = TableReference(collection_table, c1), nestedTableGroupJoins = [ TableGroupJoin( TableGroup( primaryTableReference = TableReference(association, a) ) ) ] ) ) ] ) This is necessary to correctly retain the cardinality of an HQL join like e.g. from Entity1 e left join e.collectionAssociation c on key(c) = 1

Annotations
@Override
addTableGroupJoinback to summary
public void addTableGroupJoin(TableGroupJoin join)

Implements org.hibernate.sql.ast.tree.from.TableGroup.addTableGroupJoin.

Annotations
@Override
applyAffectedTableNamesback to summary
public void applyAffectedTableNames(Consumer<String> nameCollector)

Implements org.hibernate.sql.ast.tree.from.TableGroup.applyAffectedTableNames.

Annotations
@Override
applySqlSelectionsback to summary
public void applySqlSelections(DomainResultCreationState creationState)

Overrides default org.hibernate.sql.ast.tree.from.TableGroup.applySqlSelections.

Doc from org.hibernate.query.sqm.sql.internal.DomainResultProducer.applySqlSelections.

Used when this producer is a selection in a sub-query. The DomainResult is only needed for root query of a SELECT statement. This default impl assumes this producer is a true (Sql)Expression

Annotations
@Override
canUseInnerJoinsback to summary
public boolean canUseInnerJoins()

Implements org.hibernate.sql.ast.tree.from.TableGroup.canUseInnerJoins.

Annotations
@Override
createDomainResultback to summary
public DomainResult<J> createDomainResult(String resultVariable, DomainResultCreationState creationState)

Overrides default org.hibernate.sql.ast.tree.from.TableGroup.createDomainResult.

Doc from org.hibernate.query.sqm.sql.internal.DomainResultProducer.createDomainResult.

Produce the domain query

Annotations
@Override
getElementTableGroupback to summary
public TableGroup getElementTableGroup()

Implements org.hibernate.sql.ast.tree.from.PluralTableGroup.getElementTableGroup.

Annotations
@Override
getExpressionTypeback to summary
public PluralAttributeMapping getExpressionType()

Implements org.hibernate.query.sqm.sql.internal.SqmPathInterpretation.getExpressionType.

Doc from org.hibernate.sql.ast.tree.expression.Expression.getExpressionType.

The type for this expression

Annotations
@Override
getGroupAliasback to summary
public String getGroupAlias()

Implements org.hibernate.sql.ast.tree.from.TableGroup.getGroupAlias.

Doc from org.hibernate.sql.ast.tree.from.TableGroup.getGroupAlias.

If we want to use CTE for TableGroup rendering we will need to know the alias we can use for the group

Annotations
@Override
getIndexTableGroupback to summary
public TableGroup getIndexTableGroup()

Implements org.hibernate.sql.ast.tree.from.PluralTableGroup.getIndexTableGroup.

Annotations
@Override
getModelPartback to summary
public PluralAttributeMapping getModelPart()

Implements org.hibernate.sql.ast.tree.from.TableGroup.getModelPart, org.hibernate.sql.ast.tree.from.PluralTableGroup.getModelPart.

Annotations
@Override
getNavigablePathback to summary
public NavigablePath getNavigablePath()

Implements org.hibernate.sql.ast.tree.from.TableGroup.getNavigablePath.

Annotations
@Override
getNestedTableGroupJoinsback to summary
public List<TableGroupJoin> getNestedTableGroupJoins()

Implements org.hibernate.sql.ast.tree.from.TableGroup.getNestedTableGroupJoins.

Annotations
@Override
getPrimaryTableReferenceback to summary
public TableReference getPrimaryTableReference()

Implements abstract org.hibernate.sql.ast.tree.from.AbstractColumnReferenceQualifier.getPrimaryTableReference.

Implements org.hibernate.sql.ast.tree.from.TableGroup.getPrimaryTableReference.

Annotations
@Override
getSessionFactoryback to summary
protected SessionFactoryImplementor getSessionFactory()

Implements abstract org.hibernate.sql.ast.tree.from.AbstractColumnReferenceQualifier.getSessionFactory.

Deprecated

as a consequence of SessionFactoryImplementor being deprecated. See corresponding docs for further information.

Annotations
@Override
getSourceAliasback to summary
public String getSourceAlias()

Implements org.hibernate.sql.ast.tree.from.TableGroup.getSourceAlias.

Annotations
@Override
getTableGroupJoinsback to summary
public List<TableGroupJoin> getTableGroupJoins()

Implements org.hibernate.sql.ast.tree.from.TableGroup.getTableGroupJoins.

Annotations
@Override
getTableReferenceback to summary
public TableReference getTableReference(NavigablePath navigablePath, String tableExpression, boolean resolve)

Overrides org.hibernate.sql.ast.tree.from.AbstractColumnReferenceQualifier.getTableReference.

Implements org.hibernate.sql.ast.tree.from.ColumnReferenceQualifier.getTableReference.

Doc from org.hibernate.sql.ast.tree.from.ColumnReferenceQualifier.getTableReference.

Returns the table reference for the table expression, or null if not found.

Parameters
navigablePath:NavigablePath

The path for which to look up the table reference, may be null

tableExpression:String

The table expression for which to look up the table reference

resolve:boolean

Whether to potentially create table reference joins for this table group

Annotations
@Override
getTableReferenceJoinsback to summary
public List<TableReferenceJoin> getTableReferenceJoins()

Implements abstract org.hibernate.sql.ast.tree.from.AbstractColumnReferenceQualifier.getTableReferenceJoins.

Implements org.hibernate.sql.ast.tree.from.TableGroup.getTableReferenceJoins.

Annotations
@Override
isFetchedback to summary
public boolean isFetched()

Overrides default org.hibernate.sql.ast.tree.from.TableGroup.isFetched.

Annotations
@Override
isRealTableGroupback to summary
public boolean isRealTableGroup()

Overrides default org.hibernate.sql.ast.tree.from.TableGroup.isRealTableGroup.

Annotations
@Override
prependTableGroupJoinback to summary
public void prependTableGroupJoin(NavigablePath navigablePath, TableGroupJoin join)

Implements org.hibernate.sql.ast.tree.from.TableGroup.prependTableGroupJoin.

Doc from org.hibernate.sql.ast.tree.from.TableGroup.prependTableGroupJoin.

Adds the given table group join before a join as found via the given navigable path.

Annotations
@Override
registerIndexTableGroupback to summary
public void registerIndexTableGroup(TableGroupJoin indexTableGroupJoin)
visitNestedTableGroupJoinsback to summary
public void visitNestedTableGroupJoins(Consumer<TableGroupJoin> consumer)

Implements org.hibernate.sql.ast.tree.from.TableGroup.visitNestedTableGroupJoins.

Annotations
@Override
visitTableGroupJoinsback to summary
public void visitTableGroupJoins(Consumer<TableGroupJoin> consumer)

Implements org.hibernate.sql.ast.tree.from.TableGroup.visitTableGroupJoins.

Annotations
@Override