Package org.hibernate.sql.ast.tree.from
Class StandardVirtualTableGroup
- java.lang.Object
-
- org.hibernate.sql.ast.tree.from.AbstractColumnReferenceQualifier
-
- org.hibernate.sql.ast.tree.from.AbstractTableGroup
-
- org.hibernate.sql.ast.tree.from.StandardVirtualTableGroup
-
- All Implemented Interfaces:
DomainResultProducer
,SqmPathInterpretation
,SqlSelectionProducer
,Expression
,ColumnReferenceQualifier
,TableGroup
,VirtualTableGroup
,SqlAstNode
public class StandardVirtualTableGroup extends AbstractTableGroup implements VirtualTableGroup
-
-
Constructor Summary
Constructors Constructor Description StandardVirtualTableGroup(NavigablePath navigablePath, ModelPartContainer modelPart, TableGroup underlyingTableGroup, boolean fetched)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNestedTableGroupJoin(TableGroupJoin join)
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
addTableGroupJoin(TableGroupJoin join)
void
applyAffectedTableNames(Consumer<String> nameCollector)
boolean
canUseInnerJoins()
ModelPartContainer
getExpressionType()
The type for this expressionTableReference
getPrimaryTableReference()
String
getSourceAlias()
TableReference
getTableReference(NavigablePath navigablePath, String tableExpression, boolean resolve)
Returns the table reference for the table expression, or null if not found.TableReference
getTableReference(NavigablePath navigablePath, ValuedModelPart modelPart, String tableExpression, boolean resolve)
List<TableReferenceJoin>
getTableReferenceJoins()
TableGroup
getUnderlyingTableGroup()
boolean
isFetched()
void
prependTableGroupJoin(NavigablePath navigablePath, TableGroupJoin join)
Adds the given table group join before a join as found via the given navigable path.-
Methods inherited from class org.hibernate.sql.ast.tree.from.AbstractTableGroup
getGroupAlias, getModelPart, getNavigablePath, getNestedTableGroupJoins, getSessionFactory, getSqlAliasBase, getTableGroupJoins, isRealTableGroup, toString, visitNestedTableGroupJoins, visitTableGroupJoins
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.sql.ast.tree.from.ColumnReferenceQualifier
getTableReference, getTableReference, resolveTableReference, resolveTableReference, resolveTableReference
-
Methods inherited from interface org.hibernate.sql.ast.tree.expression.Expression
createDomainResultSqlSelection, createDomainResultSqlSelection, createSqlSelection, createSqlSelection, getColumnReference
-
Methods inherited from interface org.hibernate.query.sqm.sql.internal.SqmPathInterpretation
getSqlExpression
-
Methods inherited from interface org.hibernate.sql.ast.tree.from.TableGroup
accept, applySqlSelections, createDomainResult, findCompatibleJoin, findCompatibleJoinedGroup, findTableGroupJoin, getGroupAlias, getModelPart, getNavigablePath, getNestedTableGroupJoins, getTableGroupJoins, hasRealJoins, isInitialized, isLateral, isRealTableGroup, visitNestedTableGroupJoins, visitTableGroupJoins
-
-
-
-
Constructor Detail
-
StandardVirtualTableGroup
public StandardVirtualTableGroup(NavigablePath navigablePath, ModelPartContainer modelPart, TableGroup underlyingTableGroup, boolean fetched)
-
-
Method Detail
-
getExpressionType
public ModelPartContainer getExpressionType()
Description copied from interface:Expression
The type for this expression- Specified by:
getExpressionType
in interfaceExpression
- Specified by:
getExpressionType
in interfaceSqmPathInterpretation
- Overrides:
getExpressionType
in classAbstractTableGroup
-
getUnderlyingTableGroup
public TableGroup getUnderlyingTableGroup()
- Specified by:
getUnderlyingTableGroup
in interfaceVirtualTableGroup
-
isFetched
public boolean isFetched()
- Specified by:
isFetched
in interfaceTableGroup
-
getSourceAlias
public String getSourceAlias()
- Specified by:
getSourceAlias
in interfaceTableGroup
- Overrides:
getSourceAlias
in classAbstractTableGroup
-
canUseInnerJoins
public boolean canUseInnerJoins()
- Specified by:
canUseInnerJoins
in interfaceTableGroup
- Overrides:
canUseInnerJoins
in classAbstractTableGroup
-
applyAffectedTableNames
public void applyAffectedTableNames(Consumer<String> nameCollector)
- Specified by:
applyAffectedTableNames
in interfaceTableGroup
-
getPrimaryTableReference
public TableReference getPrimaryTableReference()
- Specified by:
getPrimaryTableReference
in interfaceTableGroup
- Specified by:
getPrimaryTableReference
in classAbstractColumnReferenceQualifier
-
getTableReferenceJoins
public List<TableReferenceJoin> getTableReferenceJoins()
- Specified by:
getTableReferenceJoins
in interfaceTableGroup
- Specified by:
getTableReferenceJoins
in classAbstractColumnReferenceQualifier
-
addTableGroupJoin
public void addTableGroupJoin(TableGroupJoin join)
- Specified by:
addTableGroupJoin
in interfaceTableGroup
- Overrides:
addTableGroupJoin
in classAbstractTableGroup
-
prependTableGroupJoin
public void prependTableGroupJoin(NavigablePath navigablePath, TableGroupJoin join)
Description copied from interface:TableGroup
Adds the given table group join before a join as found via the given navigable path.- Specified by:
prependTableGroupJoin
in interfaceTableGroup
- Overrides:
prependTableGroupJoin
in classAbstractTableGroup
-
addNestedTableGroupJoin
public void addNestedTableGroupJoin(TableGroupJoin join)
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
- Overrides:
addNestedTableGroupJoin
in classAbstractTableGroup
-
getTableReference
public TableReference getTableReference(NavigablePath navigablePath, String tableExpression, boolean resolve)
Description copied from interface:ColumnReferenceQualifier
Returns the table reference for the table expression, or null if not found.- Specified by:
getTableReference
in interfaceColumnReferenceQualifier
- Overrides:
getTableReference
in classAbstractColumnReferenceQualifier
- Parameters:
navigablePath
- The path for which to look up the table reference, may be nulltableExpression
- The table expression for which to look up the table referenceresolve
- Whether to potentially create table reference joins for this table group
-
getTableReference
public TableReference getTableReference(NavigablePath navigablePath, ValuedModelPart modelPart, String tableExpression, boolean resolve)
- Specified by:
getTableReference
in interfaceColumnReferenceQualifier
-
-