Package org.hibernate.sql.ast.tree.from
Class OneToManyTableGroup
java.lang.Object
org.hibernate.sql.ast.tree.from.AbstractColumnReferenceQualifier
org.hibernate.sql.ast.tree.from.OneToManyTableGroup
- All Implemented Interfaces:
DomainResultProducer
,SqmPathInterpretation
,SqlSelectionProducer
,Expression
,ColumnReferenceQualifier
,PluralTableGroup
,TableGroup
,SqlAstNode
public class OneToManyTableGroup
extends AbstractColumnReferenceQualifier
implements TableGroup, PluralTableGroup
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.
-
Constructor Summary
ConstructorsConstructorDescriptionOneToManyTableGroup
(PluralAttributeMapping pluralAttributeMapping, TableGroup elementTableGroup, SessionFactoryImplementor sessionFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.void
void
applyAffectedTableNames
(Consumer<String> nameCollector) void
applySqlSelections
(DomainResultCreationState creationState) Used when this producer is a selection in a sub-query.boolean
createDomainResult
(String resultVariable, DomainResultCreationState creationState) Produce the domain queryThe type for this expressionIf we want to use CTE for TableGroup rendering we will need to know the alias we can use for the groupprotected SessionFactoryImplementor
getTableReference
(NavigablePath navigablePath, String tableExpression, boolean resolve) Returns the table reference for the table expression, or null if not found.boolean
boolean
void
prependTableGroupJoin
(NavigablePath navigablePath, TableGroupJoin join) Adds the given table group join before a join as found via the given navigable path.void
registerIndexTableGroup
(TableGroupJoin indexTableGroupJoin) void
registerIndexTableGroup
(TableGroupJoin indexTableGroupJoin, boolean nested) void
visitNestedTableGroupJoins
(Consumer<TableGroupJoin> consumer) void
visitTableGroupJoins
(Consumer<TableGroupJoin> consumer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hibernate.sql.ast.tree.from.ColumnReferenceQualifier
getTableReference, getTableReference, getTableReference, resolveTableReference, resolveTableReference, resolveTableReference
Methods inherited from interface org.hibernate.sql.ast.tree.expression.Expression
createDomainResultSqlSelection, createSqlSelection, getColumnReference
Methods inherited from interface org.hibernate.sql.ast.tree.from.PluralTableGroup
getTableGroup
Methods inherited from interface org.hibernate.query.sqm.sql.internal.SqmPathInterpretation
getSqlExpression
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroup
accept, findCompatibleJoin, findCompatibleJoinedGroup, findTableGroupJoin, findTableReference, hasRealJoins, isInitialized, isLateral, isVirtual
-
Constructor Details
-
OneToManyTableGroup
public OneToManyTableGroup(PluralAttributeMapping pluralAttributeMapping, TableGroup elementTableGroup, SessionFactoryImplementor sessionFactory)
-
-
Method Details
-
getExpressionType
Description copied from interface:Expression
The type for this expression- Specified by:
getExpressionType
in interfaceExpression
- Specified by:
getExpressionType
in interfaceSqmPathInterpretation
-
getModelPart
- Specified by:
getModelPart
in interfacePluralTableGroup
- Specified by:
getModelPart
in interfaceTableGroup
-
getSessionFactory
- Specified by:
getSessionFactory
in classAbstractColumnReferenceQualifier
-
getElementTableGroup
- Specified by:
getElementTableGroup
in interfacePluralTableGroup
-
getIndexTableGroup
- Specified by:
getIndexTableGroup
in interfacePluralTableGroup
-
registerIndexTableGroup
-
registerIndexTableGroup
-
getGroupAlias
Description copied from interface:TableGroup
If we want to use CTE for TableGroup rendering we will need to know the alias we can use for the group- Specified by:
getGroupAlias
in interfaceTableGroup
-
getSourceAlias
- Specified by:
getSourceAlias
in interfaceTableGroup
-
applyAffectedTableNames
- Specified by:
applyAffectedTableNames
in interfaceTableGroup
-
getPrimaryTableReference
- Specified by:
getPrimaryTableReference
in interfaceTableGroup
- Specified by:
getPrimaryTableReference
in classAbstractColumnReferenceQualifier
-
getTableReferenceJoins
- Specified by:
getTableReferenceJoins
in interfaceTableGroup
- Specified by:
getTableReferenceJoins
in classAbstractColumnReferenceQualifier
-
getTableGroupJoins
- Specified by:
getTableGroupJoins
in interfaceTableGroup
-
getNestedTableGroupJoins
- Specified by:
getNestedTableGroupJoins
in interfaceTableGroup
-
canUseInnerJoins
public boolean canUseInnerJoins()- Specified by:
canUseInnerJoins
in interfaceTableGroup
-
addTableGroupJoin
- Specified by:
addTableGroupJoin
in interfaceTableGroup
-
addNestedTableGroupJoin
Description copied from interface:TableGroup
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 asTableGroup( 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
- Specified by:
addNestedTableGroupJoin
in interfaceTableGroup
-
visitTableGroupJoins
- Specified by:
visitTableGroupJoins
in interfaceTableGroup
-
visitNestedTableGroupJoins
- Specified by:
visitNestedTableGroupJoins
in interfaceTableGroup
-
createDomainResult
public DomainResult createDomainResult(String resultVariable, DomainResultCreationState creationState) Description copied from interface:DomainResultProducer
Produce the domain query- Specified by:
createDomainResult
in interfaceDomainResultProducer
- Specified by:
createDomainResult
in interfaceTableGroup
-
applySqlSelections
Description copied from interface:DomainResultProducer
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- Specified by:
applySqlSelections
in interfaceDomainResultProducer
- Specified by:
applySqlSelections
in interfaceTableGroup
-
isRealTableGroup
public boolean isRealTableGroup()- Specified by:
isRealTableGroup
in interfaceTableGroup
-
isFetched
public boolean isFetched()- Specified by:
isFetched
in interfaceTableGroup
-