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

public Class CorrelatedTableGroup

extends AbstractTableGroup
Class Inheritance
Known Direct Subclasses
org.hibernate.sql.ast.tree.from.CorrelatedPluralTableGroup
Imports
java.util.Collections, .List, java.util.function.Consumer, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.metamodel.mapping.ValuedModelPart, org.hibernate.spi.NavigablePath, org.hibernate.sql.ast.SqlAstJoinType, org.hibernate.sql.ast.spi.SqlAliasBase, org.hibernate.sql.ast.tree.predicate.Predicate, org.hibernate.sql.ast.tree.select.QuerySpec

A virtual TableReference for correlated roots. Table group joins are pushed into the from clause as roots and join predicates to the where clause.
Author
Christian Beikov

Field Summary

Modifier and TypeField and Description
private final TableGroup
private final Consumer<Predicate>
private final QuerySpec

Constructor Summary

AccessConstructor and Description
public
CorrelatedTableGroup(TableGroup correlatedTableGroup, SqlAliasBase sqlAliasBase, QuerySpec querySpec, Consumer<Predicate> joinPredicateConsumer, SessionFactoryImplementor sessionFactory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.

Method Summary

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

Overrides org.hibernate.sql.ast.tree.from.AbstractTableGroup.addNestedTableGroupJoin.

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 TableGroup
public TableGroup
public Consumer<Predicate>
public TableReference
public TableReference
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 void
prependTableGroupJoin(NavigablePath navigablePath, TableGroupJoin join)

Overrides org.hibernate.sql.ast.tree.from.AbstractTableGroup.prependTableGroupJoin.

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.
private void
Inherited from org.hibernate.sql.ast.tree.from.AbstractTableGroup:
canUseInnerJoinsgetExpressionTypegetGroupAliasgetModelPartgetNavigablePathgetNestedTableGroupJoinsgetSessionFactorygetSourceAliasgetSqlAliasBasegetTableGroupJoinsisRealTableGrouptoStringvisitNestedTableGroupJoinsvisitTableGroupJoins

Field Detail

correlatedTableGroupback to summary
private final TableGroup correlatedTableGroup
joinPredicateConsumerback to summary
private final Consumer<Predicate> joinPredicateConsumer
querySpecback to summary
private final QuerySpec querySpec

Constructor Detail

CorrelatedTableGroupback to summary
public CorrelatedTableGroup(TableGroup correlatedTableGroup, SqlAliasBase sqlAliasBase, QuerySpec querySpec, Consumer<Predicate> joinPredicateConsumer, 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)

Overrides org.hibernate.sql.ast.tree.from.AbstractTableGroup.addNestedTableGroupJoin.

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)

Overrides org.hibernate.sql.ast.tree.from.AbstractTableGroup.addTableGroupJoin.

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
findCompatibleJoinedGroupback to summary
public TableGroup findCompatibleJoinedGroup(TableGroupJoinProducer joinProducer, SqlAstJoinType requestedJoinType)

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

Annotations
@Override
getCorrelatedTableGroupback to summary
public TableGroup getCorrelatedTableGroup()
getJoinPredicateConsumerback to summary
public Consumer<Predicate> getJoinPredicateConsumer()
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
getTableReferenceback to summary
public TableReference getTableReference(NavigablePath navigablePath, ValuedModelPart modelPart, String tableExpression, boolean resolve)

Overrides default org.hibernate.sql.ast.tree.from.ColumnReferenceQualifier.getTableReference.

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
prependTableGroupJoinback to summary
public void prependTableGroupJoin(NavigablePath navigablePath, TableGroupJoin join)

Overrides org.hibernate.sql.ast.tree.from.AbstractTableGroup.prependTableGroupJoin.

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
registerPredicateback to summary
private void registerPredicate(TableGroupJoin join)