Search in sources :

Example 21 with SqlSelection

use of org.hibernate.sql.ast.spi.SqlSelection in project hibernate-orm by hibernate.

the class AggregateWindowEmulationQueryTransformer method transform.

@Override
public QuerySpec transform(CteContainer cteContainer, QuerySpec querySpec, SqmToSqlAstConverter converter) {
    final SessionFactoryImplementor factory = converter.getCreationContext().getSessionFactory();
    final QuerySpec outerQuerySpec = new QuerySpec(querySpec.isRoot());
    final String identifierVariable = "hhh_";
    final NavigablePath navigablePath = new NavigablePath(identifierVariable, identifierVariable);
    final SelectClause selectClause = outerQuerySpec.getSelectClause();
    final QuerySpec subQuerySpec = querySpec.asSubQuery();
    final SelectClause subSelectClause = subQuerySpec.getSelectClause();
    final List<SqlSelection> subSelections = subSelectClause.getSqlSelections();
    final List<String> columnNames = new ArrayList<>(subSelections.size());
    // A map to find the select item position for an expression
    // which is needed to decide if we need to introduce synthetic select items
    // for group by items, since these group by items are migrated to the outer query
    final Map<Expression, Integer> selectionMapping = new HashMap<>(subSelections.size());
    // for the QueryPartTableGroup within which the sub query spec is embedded
    for (int i = 0; i < subSelections.size(); i++) {
        final BasicValuedMapping mapping = (BasicValuedMapping) subSelections.get(i).getExpressionType();
        final String columnName = "col" + i;
        final ColumnReference columnReference = new ColumnReference(identifierVariable, columnName, false, null, null, mapping.getJdbcMapping(), factory);
        final Expression expression = subSelections.get(i).getExpression();
        final Expression finalExpression;
        if (expression == windowFunction) {
            finalExpression = new SelfRenderingAggregateFunctionSqlAstExpression("min", (sqlAppender, sqlAstArguments, walker1) -> {
                sqlAppender.appendSql("min(");
                sqlAstArguments.get(0).accept(walker1);
                sqlAppender.append(')');
            }, Collections.singletonList(columnReference), null, (ReturnableType<?>) mapping.getMappedType(), expression.getExpressionType());
        } else {
            finalExpression = columnReference;
            selectionMapping.put(expression, i);
        }
        columnNames.add(columnName);
        selectClause.addSqlSelection(new ResolvedSqlSelection(i + 1, i, finalExpression, (BasicType<Object>) mapping.getJdbcMapping()));
    }
    // Migrate the group by clause to the outer query
    // and push group by expressions into the partition by clause of the window function
    final List<Expression> groupByExpressions = new ArrayList<>(subQuerySpec.getGroupByClauseExpressions().size());
    for (Expression groupByClauseExpression : subQuerySpec.getGroupByClauseExpressions()) {
        final Expression realExpression;
        final Expression outerGroupByExpression;
        if (groupByClauseExpression instanceof SqlSelectionExpression) {
            final SqlSelection selection = ((SqlSelectionExpression) groupByClauseExpression).getSelection();
            outerGroupByExpression = new SqlSelectionExpression(selectClause.getSqlSelections().get(selection.getValuesArrayPosition()));
            realExpression = selection.getExpression();
        } else {
            if (groupByClauseExpression instanceof SqmPathInterpretation<?>) {
                realExpression = ((SqmPathInterpretation<?>) groupByClauseExpression).getSqlExpression();
            } else {
                realExpression = groupByClauseExpression;
            }
            final Integer position = selectionMapping.get(realExpression);
            if (position == null) {
                // Group by something that has no corresponding selection item,
                // so we need to introduce an intermediate selection item
                final int valuesPosition = selectClause.getSqlSelections().size();
                final String columnName = "col" + valuesPosition;
                final JdbcMapping jdbcMapping = realExpression.getExpressionType().getJdbcMappings().get(0);
                final ColumnReference columnReference = new ColumnReference(identifierVariable, columnName, false, null, null, jdbcMapping, factory);
                final int subValuesPosition = subSelectClause.getSqlSelections().size();
                final SqlSelection subSelection = new ResolvedSqlSelection(subValuesPosition + 1, subValuesPosition, realExpression, (BasicType<Object>) jdbcMapping);
                columnNames.add(columnName);
                subSelectClause.addSqlSelection(subSelection);
                outerGroupByExpression = columnReference;
                selectionMapping.put(realExpression, subValuesPosition);
            } else {
                outerGroupByExpression = new SqlSelectionExpression(selectClause.getSqlSelections().get(position));
            }
        }
        windowFunction.getPartitions().add(realExpression);
        groupByExpressions.add(outerGroupByExpression);
    }
    outerQuerySpec.setGroupByClauseExpressions(groupByExpressions);
    subQuerySpec.setGroupByClauseExpressions(null);
    // Migrate the having clause to the outer query
    if (subQuerySpec.getHavingClauseRestrictions() != null) {
        final Predicate predicate = new ExpressionReplacementWalker() {

            @Override
            protected <X extends SqlAstNode> X replaceExpression(X expression) {
                if (expression instanceof Literal || expression instanceof JdbcParameter) {
                    return expression;
                }
                final Expression outerExpression;
                if (expression instanceof SqlSelectionExpression) {
                    final SqlSelection selection = ((SqlSelectionExpression) expression).getSelection();
                    outerExpression = selectClause.getSqlSelections().get(selection.getValuesArrayPosition()).getExpression();
                } else {
                    final Expression realExpression;
                    if (expression instanceof SqmPathInterpretation<?>) {
                        realExpression = ((SqmPathInterpretation<?>) expression).getSqlExpression();
                    } else {
                        realExpression = (Expression) expression;
                    }
                    final Integer position = selectionMapping.get(realExpression);
                    if (position == null) {
                        // An expression that has no corresponding selection item,
                        // so we need to introduce an intermediate selection item
                        final int valuesPosition = selectClause.getSqlSelections().size();
                        final String columnName = "col" + valuesPosition;
                        final JdbcMapping jdbcMapping = realExpression.getExpressionType().getJdbcMappings().get(0);
                        final ColumnReference columnReference = new ColumnReference(identifierVariable, columnName, false, null, null, jdbcMapping, factory);
                        final int subValuesPosition = subSelectClause.getSqlSelections().size();
                        final SqlSelection subSelection = new ResolvedSqlSelection(subValuesPosition + 1, subValuesPosition, realExpression, (BasicType<Object>) jdbcMapping);
                        columnNames.add(columnName);
                        subSelectClause.addSqlSelection(subSelection);
                        outerExpression = columnReference;
                        selectionMapping.put(realExpression, subValuesPosition);
                    } else {
                        outerExpression = selectClause.getSqlSelections().get(position).getExpression();
                    }
                }
                return (X) outerExpression;
            }
        }.replaceExpressions(subQuerySpec.getHavingClauseRestrictions());
        outerQuerySpec.setHavingClauseRestrictions(predicate);
        subQuerySpec.setHavingClauseRestrictions(null);
    }
    // Migrate the order by clause to the outer query
    if (subQuerySpec.hasSortSpecifications()) {
        for (SortSpecification sortSpecification : subQuerySpec.getSortSpecifications()) {
            final Expression sortExpression = sortSpecification.getSortExpression();
            final Expression outerSortExpression;
            if (sortExpression instanceof SqlSelectionExpression) {
                final SqlSelection selection = ((SqlSelectionExpression) sortExpression).getSelection();
                outerSortExpression = new SqlSelectionExpression(selectClause.getSqlSelections().get(selection.getValuesArrayPosition()));
            } else {
                final Expression realExpression;
                if (sortExpression instanceof SqmPathInterpretation<?>) {
                    realExpression = ((SqmPathInterpretation<?>) sortExpression).getSqlExpression();
                } else {
                    realExpression = sortExpression;
                }
                final Integer position = selectionMapping.get(realExpression);
                if (position == null) {
                    // Group by something that has no corresponding selection item,
                    // so we need to introduce an intermediate selection item
                    final int valuesPosition = selectClause.getSqlSelections().size();
                    final String columnName = "col" + valuesPosition;
                    final JdbcMapping jdbcMapping = realExpression.getExpressionType().getJdbcMappings().get(0);
                    final ColumnReference columnReference = new ColumnReference(identifierVariable, columnName, false, null, null, jdbcMapping, factory);
                    final int subValuesPosition = subSelectClause.getSqlSelections().size();
                    final SqlSelection subSelection = new ResolvedSqlSelection(subValuesPosition + 1, subValuesPosition, realExpression, (BasicType<Object>) jdbcMapping);
                    columnNames.add(columnName);
                    subSelectClause.addSqlSelection(subSelection);
                    outerSortExpression = columnReference;
                    selectionMapping.put(realExpression, subValuesPosition);
                } else {
                    outerSortExpression = new SqlSelectionExpression(selectClause.getSqlSelections().get(position));
                }
            }
            outerQuerySpec.addSortSpecification(new SortSpecification(outerSortExpression, sortSpecification.getSortOrder(), sortSpecification.getNullPrecedence()));
        }
        subQuerySpec.getSortSpecifications().clear();
    }
    // We need to add selection items for the expressions we order by to the sub query spec.
    final int selectionOffset = columnNames.size();
    // Collect the sorting column references so we can apply the filter later
    final List<ColumnReference> sortingColumns = new ArrayList<>(withinGroup.size());
    for (int i = 0; i < withinGroup.size(); i++) {
        final int valueIndex = selectionOffset + i;
        final Expression sortExpression = withinGroup.get(i).getSortExpression();
        final BasicValuedMapping mapping = (BasicValuedMapping) sortExpression.getExpressionType();
        final String columnName = "col" + valueIndex;
        final int oldValueIndex = subSelectClause.getSqlSelections().size();
        columnNames.add(columnName);
        subSelectClause.addSqlSelection(new ResolvedSqlSelection(oldValueIndex + 1, oldValueIndex, sortExpression, (BasicType<Object>) mapping.getJdbcMapping()));
        sortingColumns.add(new ColumnReference(identifierVariable, columnName, false, null, null, mapping.getJdbcMapping(), factory));
    }
    if (arguments != null) {
        // So we add a filter to the outer query so we can extract the rank
        switch(arguments.size()) {
            case 0:
                break;
            case 1:
                outerQuerySpec.applyPredicate(new ComparisonPredicate(sortingColumns.get(0), ComparisonOperator.EQUAL, (Expression) arguments.get(0)));
                break;
            default:
                outerQuerySpec.applyPredicate(new ComparisonPredicate(new SqlTuple(sortingColumns, null), ComparisonOperator.EQUAL, new SqlTuple((List<? extends Expression>) (List<?>) arguments, null)));
        }
    }
    final QueryPartTableGroup queryPartTableGroup = new QueryPartTableGroup(navigablePath, null, subQuerySpec, identifierVariable, columnNames, false, true, factory);
    outerQuerySpec.getFromClause().addRoot(queryPartTableGroup);
    // Migrate the offset/fetch clause
    outerQuerySpec.setOffsetClauseExpression(subQuerySpec.getOffsetClauseExpression());
    outerQuerySpec.setFetchClauseExpression(subQuerySpec.getFetchClauseExpression(), subQuerySpec.getFetchClauseType());
    subQuerySpec.setOffsetClauseExpression(null);
    subQuerySpec.setFetchClauseExpression(null, null);
    return outerQuerySpec;
}
Also used : JdbcMapping(org.hibernate.metamodel.mapping.JdbcMapping) BasicType(org.hibernate.type.BasicType) CteContainer(org.hibernate.sql.ast.tree.cte.CteContainer) ColumnReference(org.hibernate.sql.ast.tree.expression.ColumnReference) HashMap(java.util.HashMap) SortSpecification(org.hibernate.sql.ast.tree.select.SortSpecification) ArrayList(java.util.ArrayList) ExpressionReplacementWalker(org.hibernate.sql.ast.spi.ExpressionReplacementWalker) ComparisonPredicate(org.hibernate.sql.ast.tree.predicate.ComparisonPredicate) Map(java.util.Map) SqlAstNode(org.hibernate.sql.ast.tree.SqlAstNode) ComparisonOperator(org.hibernate.query.sqm.ComparisonOperator) ReturnableType(org.hibernate.query.ReturnableType) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection) SelfRenderingAggregateFunctionSqlAstExpression(org.hibernate.query.sqm.function.SelfRenderingAggregateFunctionSqlAstExpression) Predicate(org.hibernate.sql.ast.tree.predicate.Predicate) ResolvedSqlSelection(org.hibernate.sql.results.internal.ResolvedSqlSelection) SqlSelectionExpression(org.hibernate.sql.ast.tree.expression.SqlSelectionExpression) BasicValuedMapping(org.hibernate.metamodel.mapping.BasicValuedMapping) Expression(org.hibernate.sql.ast.tree.expression.Expression) SqmToSqlAstConverter(org.hibernate.query.sqm.sql.SqmToSqlAstConverter) NavigablePath(org.hibernate.spi.NavigablePath) QueryTransformer(org.hibernate.sql.ast.tree.expression.QueryTransformer) SelectClause(org.hibernate.sql.ast.tree.select.SelectClause) List(java.util.List) JdbcParameter(org.hibernate.sql.ast.tree.expression.JdbcParameter) QueryPartTableGroup(org.hibernate.sql.ast.tree.from.QueryPartTableGroup) Literal(org.hibernate.sql.ast.tree.expression.Literal) SqlTuple(org.hibernate.sql.ast.tree.expression.SqlTuple) Over(org.hibernate.sql.ast.tree.expression.Over) QuerySpec(org.hibernate.sql.ast.tree.select.QuerySpec) Collections(java.util.Collections) SqmPathInterpretation(org.hibernate.query.sqm.sql.internal.SqmPathInterpretation) SelectClause(org.hibernate.sql.ast.tree.select.SelectClause) SelfRenderingAggregateFunctionSqlAstExpression(org.hibernate.query.sqm.function.SelfRenderingAggregateFunctionSqlAstExpression) NavigablePath(org.hibernate.spi.NavigablePath) BasicType(org.hibernate.type.BasicType) JdbcMapping(org.hibernate.metamodel.mapping.JdbcMapping) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ComparisonPredicate(org.hibernate.sql.ast.tree.predicate.ComparisonPredicate) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection) ResolvedSqlSelection(org.hibernate.sql.results.internal.ResolvedSqlSelection) ComparisonPredicate(org.hibernate.sql.ast.tree.predicate.ComparisonPredicate) Predicate(org.hibernate.sql.ast.tree.predicate.Predicate) ReturnableType(org.hibernate.query.ReturnableType) ExpressionReplacementWalker(org.hibernate.sql.ast.spi.ExpressionReplacementWalker) Literal(org.hibernate.sql.ast.tree.expression.Literal) ResolvedSqlSelection(org.hibernate.sql.results.internal.ResolvedSqlSelection) SqmPathInterpretation(org.hibernate.query.sqm.sql.internal.SqmPathInterpretation) ArrayList(java.util.ArrayList) List(java.util.List) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) JdbcParameter(org.hibernate.sql.ast.tree.expression.JdbcParameter) QueryPartTableGroup(org.hibernate.sql.ast.tree.from.QueryPartTableGroup) SqlSelectionExpression(org.hibernate.sql.ast.tree.expression.SqlSelectionExpression) BasicValuedMapping(org.hibernate.metamodel.mapping.BasicValuedMapping) SelfRenderingAggregateFunctionSqlAstExpression(org.hibernate.query.sqm.function.SelfRenderingAggregateFunctionSqlAstExpression) SqlSelectionExpression(org.hibernate.sql.ast.tree.expression.SqlSelectionExpression) Expression(org.hibernate.sql.ast.tree.expression.Expression) SortSpecification(org.hibernate.sql.ast.tree.select.SortSpecification) SqlTuple(org.hibernate.sql.ast.tree.expression.SqlTuple) QuerySpec(org.hibernate.sql.ast.tree.select.QuerySpec) ColumnReference(org.hibernate.sql.ast.tree.expression.ColumnReference)

Example 22 with SqlSelection

use of org.hibernate.sql.ast.spi.SqlSelection in project hibernate-orm by hibernate.

the class DynamicResultBuilderBasicConverted method buildResult.

@Override
public BasicResult<?> buildResult(JdbcValuesMetadata jdbcResultsMetadata, int resultPosition, BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver, DomainResultCreationState domainResultCreationState) {
    final TypeConfiguration typeConfiguration = domainResultCreationState.getSqlAstCreationState().getCreationContext().getSessionFactory().getTypeConfiguration();
    final SqlExpressionResolver sqlExpressionResolver = domainResultCreationState.getSqlAstCreationState().getSqlExpressionResolver();
    final SqlSelection sqlSelection = sqlExpressionResolver.resolveSqlSelection(sqlExpressionResolver.resolveSqlExpression(columnAlias, state -> {
        final int currentJdbcPosition = resultPosition + 1;
        final int jdbcPosition;
        if (columnAlias != null) {
            jdbcPosition = jdbcResultsMetadata.resolveColumnPosition(columnAlias);
        } else {
            jdbcPosition = currentJdbcPosition;
        }
        final BasicType<?> basicType = jdbcResultsMetadata.resolveType(jdbcPosition, basicValueConverter.getRelationalJavaType(), domainResultCreationState.getSqlAstCreationState().getCreationContext().getSessionFactory());
        final int valuesArrayPosition = ResultsHelper.jdbcPositionToValuesArrayPosition(jdbcPosition);
        return new ResultSetMappingSqlSelection(valuesArrayPosition, (BasicValuedMapping) basicType);
    }), basicValueConverter.getDomainJavaType(), null, typeConfiguration);
    return new BasicResult<>(sqlSelection.getValuesArrayPosition(), columnAlias, basicValueConverter.getDomainJavaType(), basicValueConverter);
}
Also used : DomainResultCreationState(org.hibernate.sql.results.graph.DomainResultCreationState) JpaAttributeConverterImpl(org.hibernate.metamodel.model.convert.internal.JpaAttributeConverterImpl) ProvidedInstanceManagedBeanImpl(org.hibernate.resource.beans.spi.ProvidedInstanceManagedBeanImpl) ResultSetMappingSqlSelection(org.hibernate.query.results.ResultSetMappingSqlSelection) TypeConfiguration(org.hibernate.type.spi.TypeConfiguration) BasicType(org.hibernate.type.BasicType) BiFunction(java.util.function.BiFunction) JavaType(org.hibernate.type.descriptor.java.JavaType) BasicValuedMapping(org.hibernate.metamodel.mapping.BasicValuedMapping) BasicResult(org.hibernate.sql.results.graph.basic.BasicResult) SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) Objects(java.util.Objects) JdbcValuesMetadata(org.hibernate.sql.results.jdbc.spi.JdbcValuesMetadata) ResultsHelper(org.hibernate.query.results.ResultsHelper) ManagedBean(org.hibernate.resource.beans.spi.ManagedBean) ManagedBeanRegistry(org.hibernate.resource.beans.spi.ManagedBeanRegistry) BasicValueConverter(org.hibernate.metamodel.model.convert.spi.BasicValueConverter) AttributeConverter(jakarta.persistence.AttributeConverter) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection) JavaTypeRegistry(org.hibernate.type.descriptor.java.spi.JavaTypeRegistry) BasicValuedMapping(org.hibernate.metamodel.mapping.BasicValuedMapping) BasicType(org.hibernate.type.BasicType) SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) BasicResult(org.hibernate.sql.results.graph.basic.BasicResult) TypeConfiguration(org.hibernate.type.spi.TypeConfiguration) ResultSetMappingSqlSelection(org.hibernate.query.results.ResultSetMappingSqlSelection) ResultSetMappingSqlSelection(org.hibernate.query.results.ResultSetMappingSqlSelection) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection)

Example 23 with SqlSelection

use of org.hibernate.sql.ast.spi.SqlSelection in project hibernate-orm by hibernate.

the class JdbcLiteral method createDomainResult.

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// DomainResultProducer
@Override
public DomainResult<T> createDomainResult(String resultVariable, DomainResultCreationState creationState) {
    final SqlAstCreationState sqlAstCreationState = creationState.getSqlAstCreationState();
    final SqlExpressionResolver sqlExpressionResolver = sqlAstCreationState.getSqlExpressionResolver();
    final SqlSelection sqlSelection = sqlExpressionResolver.resolveSqlSelection(this, jdbcMapping.getJavaTypeDescriptor(), null, sqlAstCreationState.getCreationContext().getMappingMetamodel().getTypeConfiguration());
    // noinspection unchecked
    return new BasicResult(sqlSelection.getValuesArrayPosition(), resultVariable, jdbcMapping.getJavaTypeDescriptor());
}
Also used : SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) BasicResult(org.hibernate.sql.results.graph.basic.BasicResult) SqlAstCreationState(org.hibernate.sql.ast.spi.SqlAstCreationState) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection)

Example 24 with SqlSelection

use of org.hibernate.sql.ast.spi.SqlSelection in project hibernate-orm by hibernate.

the class QueryLiteral method createDomainResult.

@Override
public DomainResult<T> createDomainResult(String resultVariable, DomainResultCreationState creationState) {
    final SqlExpressionResolver sqlExpressionResolver = creationState.getSqlAstCreationState().getSqlExpressionResolver();
    final SqlSelection sqlSelection = sqlExpressionResolver.resolveSqlSelection(this, type.getMappedType().getMappedJavaType(), null, creationState.getSqlAstCreationState().getCreationContext().getSessionFactory().getTypeConfiguration());
    return new BasicResult(sqlSelection.getValuesArrayPosition(), resultVariable, type.getMappedType().getMappedJavaType());
}
Also used : SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) BasicResult(org.hibernate.sql.results.graph.basic.BasicResult) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection)

Example 25 with SqlSelection

use of org.hibernate.sql.ast.spi.SqlSelection in project hibernate-orm by hibernate.

the class SimpleForeignKeyDescriptor method createDomainResult.

private <T> DomainResult<T> createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, SelectableMapping selectableMapping, DomainResultCreationState creationState) {
    final SqlAstCreationState sqlAstCreationState = creationState.getSqlAstCreationState();
    final SqlExpressionResolver sqlExpressionResolver = sqlAstCreationState.getSqlExpressionResolver();
    final TableReference tableReference = tableGroup.resolveTableReference(navigablePath.append(getTargetPart().getFetchableName()), selectableMapping.getContainingTableExpression());
    final String identificationVariable = tableReference.getIdentificationVariable();
    final SqlSelection sqlSelection = sqlExpressionResolver.resolveSqlSelection(sqlExpressionResolver.resolveSqlExpression(SqlExpressionResolver.createColumnReferenceKey(tableReference, selectableMapping.getSelectionExpression()), s -> new ColumnReference(identificationVariable, selectableMapping, creationState.getSqlAstCreationState().getCreationContext().getSessionFactory())), selectableMapping.getJdbcMapping().getJavaTypeDescriptor(), sqlAstCreationState.getCreationContext().getSessionFactory().getTypeConfiguration());
    // noinspection unchecked
    return new BasicResult<T>(sqlSelection.getValuesArrayPosition(), null, selectableMapping.getJdbcMapping().getJavaTypeDescriptor());
}
Also used : BasicValuedModelPart(org.hibernate.metamodel.mapping.BasicValuedModelPart) DomainResultCreationState(org.hibernate.sql.results.graph.DomainResultCreationState) JdbcMapping(org.hibernate.metamodel.mapping.JdbcMapping) ColumnReference(org.hibernate.sql.ast.tree.expression.ColumnReference) JavaType(org.hibernate.type.descriptor.java.JavaType) Clause(org.hibernate.sql.ast.Clause) PropertyAccess(org.hibernate.property.access.spi.PropertyAccess) EntityMappingType(org.hibernate.metamodel.mapping.EntityMappingType) MappingType(org.hibernate.metamodel.mapping.MappingType) SqlAstCreationContext(org.hibernate.sql.ast.spi.SqlAstCreationContext) TableReference(org.hibernate.sql.ast.tree.from.TableReference) ModelPart(org.hibernate.metamodel.mapping.ModelPart) ComparisonPredicate(org.hibernate.sql.ast.tree.predicate.ComparisonPredicate) ForeignKeyDescriptor(org.hibernate.metamodel.mapping.ForeignKeyDescriptor) HibernateProxy(org.hibernate.proxy.HibernateProxy) FetchOptions(org.hibernate.sql.results.graph.FetchOptions) BiConsumer(java.util.function.BiConsumer) ManagedMappingType(org.hibernate.metamodel.mapping.ManagedMappingType) ComparisonOperator(org.hibernate.query.sqm.ComparisonOperator) TableGroupProducer(org.hibernate.sql.ast.tree.from.TableGroupProducer) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection) IntFunction(java.util.function.IntFunction) SqlAstCreationState(org.hibernate.sql.ast.spi.SqlAstCreationState) FetchTiming(org.hibernate.engine.FetchTiming) AssociationKey(org.hibernate.metamodel.mapping.AssociationKey) Predicate(org.hibernate.sql.ast.tree.predicate.Predicate) NavigablePath(org.hibernate.query.spi.NavigablePath) DomainResult(org.hibernate.sql.results.graph.DomainResult) Expression(org.hibernate.sql.ast.tree.expression.Expression) PropertyBasedMapping(org.hibernate.metamodel.mapping.PropertyBasedMapping) Fetch(org.hibernate.sql.results.graph.Fetch) BasicResult(org.hibernate.sql.results.graph.basic.BasicResult) SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) NavigableRole(org.hibernate.metamodel.model.domain.NavigableRole) FetchStyle(org.hibernate.engine.FetchStyle) List(java.util.List) SelectableMapping(org.hibernate.metamodel.mapping.SelectableMapping) Collections(java.util.Collections) SelectableConsumer(org.hibernate.metamodel.mapping.SelectableConsumer) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) SharedSessionContractImplementor(org.hibernate.engine.spi.SharedSessionContractImplementor) IndexedConsumer(org.hibernate.mapping.IndexedConsumer) FetchParent(org.hibernate.sql.results.graph.FetchParent) TableReference(org.hibernate.sql.ast.tree.from.TableReference) SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) BasicResult(org.hibernate.sql.results.graph.basic.BasicResult) SqlAstCreationState(org.hibernate.sql.ast.spi.SqlAstCreationState) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection) ColumnReference(org.hibernate.sql.ast.tree.expression.ColumnReference)

Aggregations

SqlSelection (org.hibernate.sql.ast.spi.SqlSelection)48 TableGroup (org.hibernate.sql.ast.tree.from.TableGroup)26 BasicResult (org.hibernate.sql.results.graph.basic.BasicResult)23 SqlExpressionResolver (org.hibernate.sql.ast.spi.SqlExpressionResolver)22 NavigablePath (org.hibernate.spi.NavigablePath)19 ColumnReference (org.hibernate.sql.ast.tree.expression.ColumnReference)19 Expression (org.hibernate.sql.ast.tree.expression.Expression)16 DomainResultCreationState (org.hibernate.sql.results.graph.DomainResultCreationState)16 SqlAstCreationState (org.hibernate.sql.ast.spi.SqlAstCreationState)15 BasicFetch (org.hibernate.sql.results.graph.basic.BasicFetch)15 TableReference (org.hibernate.sql.ast.tree.from.TableReference)14 JavaType (org.hibernate.type.descriptor.java.JavaType)14 DomainResult (org.hibernate.sql.results.graph.DomainResult)13 FetchTiming (org.hibernate.engine.FetchTiming)12 SharedSessionContractImplementor (org.hibernate.engine.spi.SharedSessionContractImplementor)12 EntityMappingType (org.hibernate.metamodel.mapping.EntityMappingType)12 JdbcMapping (org.hibernate.metamodel.mapping.JdbcMapping)12 Fetch (org.hibernate.sql.results.graph.Fetch)12 ArrayList (java.util.ArrayList)11 BiConsumer (java.util.function.BiConsumer)11