use of org.hibernate.sql.ast.tree.from.PluralTableGroup in project hibernate-orm by hibernate.
the class BasicValuedCollectionPart method resolveSqlSelection.
private SqlSelection resolveSqlSelection(NavigablePath navigablePath, TableGroup tableGroup, boolean allowFkOptimization, DomainResultCreationState creationState) {
final SqlExpressionResolver exprResolver = creationState.getSqlAstCreationState().getSqlExpressionResolver();
final TableGroup targetTableGroup;
// into the element table group though because the element table group navigable path is not the parent of this navigable path
if (nature == Nature.INDEX && collectionDescriptor.getAttributeMapping().getIndexMetadata().getIndexPropertyName() != null) {
targetTableGroup = ((PluralTableGroup) tableGroup).getElementTableGroup();
} else {
targetTableGroup = tableGroup;
}
final TableReference tableReference = targetTableGroup.resolveTableReference(navigablePath, getContainingTableExpression(), allowFkOptimization);
return exprResolver.resolveSqlSelection(exprResolver.resolveSqlExpression(SqlExpressionResolver.createColumnReferenceKey(tableReference, selectableMapping.getSelectionExpression()), sqlAstProcessingState -> new ColumnReference(tableReference, selectableMapping, creationState.getSqlAstCreationState().getCreationContext().getSessionFactory())), getJavaType(), creationState.getSqlAstCreationState().getCreationContext().getSessionFactory().getTypeConfiguration());
}
Aggregations