Search in sources :

Example 46 with QuerySpec

use of org.hibernate.sql.ast.tree.select.QuerySpec in project hibernate-orm by hibernate.

the class MatchingIdSelectionHelper method generateMatchingIdSelectStatement.

/**
 * @asciidoc
 *
 * Generates a query-spec for selecting all ids matching the restriction defined as part
 * of the user's update/delete query.  This query-spec is generally used:
 *
 * 		* to select all the matching ids via JDBC - see {@link MatchingIdSelectionHelper#selectMatchingIds}
 * 		* as a sub-query restriction to insert rows into an "id table"
 */
public static SelectStatement generateMatchingIdSelectStatement(EntityMappingType targetEntityDescriptor, SqmDeleteOrUpdateStatement sqmStatement, boolean queryRoot, Predicate restriction, MultiTableSqmMutationConverter sqmConverter, DomainQueryExecutionContext executionContext, SessionFactoryImplementor sessionFactory) {
    final EntityDomainType entityDomainType = sqmStatement.getTarget().getModel();
    if (log.isTraceEnabled()) {
        log.tracef("Starting generation of entity-id SQM selection - %s", entityDomainType.getHibernateEntityName());
    }
    final QuerySpec idSelectionQuery = new QuerySpec(queryRoot, 1);
    idSelectionQuery.applyPredicate(restriction);
    final TableGroup mutatingTableGroup = sqmConverter.getMutatingTableGroup();
    idSelectionQuery.getFromClause().addRoot(mutatingTableGroup);
    final List<DomainResult<?>> domainResults = new ArrayList<>();
    sqmConverter.getProcessingStateStack().push(new SqlAstQueryPartProcessingStateImpl(idSelectionQuery, sqmConverter.getCurrentProcessingState(), sqmConverter.getSqlAstCreationState(), sqmConverter.getCurrentClauseStack()::getCurrent, false));
    targetEntityDescriptor.getIdentifierMapping().applySqlSelections(mutatingTableGroup.getNavigablePath(), mutatingTableGroup, sqmConverter, (selection, jdbcMapping) -> {
        domainResults.add(new BasicResult<>(selection.getValuesArrayPosition(), null, jdbcMapping.getJavaTypeDescriptor()));
    });
    sqmConverter.getProcessingStateStack().pop();
    targetEntityDescriptor.getEntityPersister().applyBaseRestrictions(idSelectionQuery::applyPredicate, mutatingTableGroup, true, executionContext.getSession().getLoadQueryInfluencers().getEnabledFilters(), null, sqmConverter);
    return new SelectStatement(idSelectionQuery, domainResults);
}
Also used : SqlAstQueryPartProcessingStateImpl(org.hibernate.query.sqm.sql.internal.SqlAstQueryPartProcessingStateImpl) SelectStatement(org.hibernate.sql.ast.tree.select.SelectStatement) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) ArrayList(java.util.ArrayList) DomainResult(org.hibernate.sql.results.graph.DomainResult) EntityDomainType(org.hibernate.metamodel.model.domain.EntityDomainType) QuerySpec(org.hibernate.sql.ast.tree.select.QuerySpec)

Example 47 with QuerySpec

use of org.hibernate.sql.ast.tree.select.QuerySpec in project hibernate-orm by hibernate.

the class AbstractCteMutationHandler method createIdSubQuery.

protected QuerySpec createIdSubQuery(CteStatement idSelectCte, ModelPart fkModelPart, SessionFactoryImplementor factory) {
    final NamedTableReference idSelectTableReference = new NamedTableReference(idSelectCte.getCteTable().getTableExpression(), CTE_TABLE_IDENTIFIER, false, factory);
    final List<CteColumn> cteColumns = idSelectCte.getCteTable().getCteColumns();
    final int size = cteColumns.size();
    final QuerySpec subQuery = new QuerySpec(false, 1);
    subQuery.getFromClause().addRoot(new CteTableGroup(idSelectTableReference));
    final SelectClause subQuerySelectClause = subQuery.getSelectClause();
    if (fkModelPart == null) {
        for (int i = 0; i < size; i++) {
            final CteColumn cteColumn = cteColumns.get(i);
            subQuerySelectClause.addSqlSelection(new SqlSelectionImpl(i + 1, i, new ColumnReference(idSelectTableReference, cteColumn.getColumnExpression(), cteColumn.getJdbcMapping(), factory)));
        }
    } else {
        fkModelPart.forEachSelectable((selectionIndex, selectableMapping) -> {
            subQuerySelectClause.addSqlSelection(new SqlSelectionImpl(selectionIndex + 1, selectionIndex, new ColumnReference(idSelectTableReference, selectableMapping.getSelectionExpression(), selectableMapping.getJdbcMapping(), factory)));
        });
    }
    return subQuery;
}
Also used : CteColumn(org.hibernate.sql.ast.tree.cte.CteColumn) SelectClause(org.hibernate.sql.ast.tree.select.SelectClause) CteTableGroup(org.hibernate.sql.ast.tree.cte.CteTableGroup) NamedTableReference(org.hibernate.sql.ast.tree.from.NamedTableReference) SqlSelectionImpl(org.hibernate.sql.results.internal.SqlSelectionImpl) QuerySpec(org.hibernate.sql.ast.tree.select.QuerySpec) ColumnReference(org.hibernate.sql.ast.tree.expression.ColumnReference)

Example 48 with QuerySpec

use of org.hibernate.sql.ast.tree.select.QuerySpec in project hibernate-orm by hibernate.

the class UpdateExecutionDelegate method updateTable.

private void updateTable(String tableExpression, Supplier<Consumer<SelectableConsumer>> tableKeyColumnVisitationSupplier, int expectedUpdateCount, QuerySpec idTableSubQuery, ExecutionContext executionContext) {
    final TableReference updatingTableReference = updatingTableGroup.getTableReference(updatingTableGroup.getNavigablePath(), tableExpression, true, true);
    final List<Assignment> assignments = assignmentsByTable.get(updatingTableReference);
    if (assignments == null || assignments.isEmpty()) {
        // no assignments for this table - skip it
        return;
    }
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // create the in-subquery predicate to restrict the updates to just
    // matching ids
    final TableKeyExpressionCollector keyColumnCollector = new TableKeyExpressionCollector(entityDescriptor);
    tableKeyColumnVisitationSupplier.get().accept((columnIndex, selection) -> {
        assert selection.getContainingTableExpression().equals(tableExpression);
        keyColumnCollector.apply(new ColumnReference((String) null, selection, sessionFactory));
    });
    final Expression keyExpression = keyColumnCollector.buildKeyExpression();
    final InSubQueryPredicate idTableSubQueryPredicate = new InSubQueryPredicate(keyExpression, idTableSubQuery, false);
    // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    // Create the SQL AST and convert it into a JdbcOperation
    final NamedTableReference dmlTableReference = resolveUnionTableReference(updatingTableReference, tableExpression);
    final UpdateStatement sqlAst = new UpdateStatement(dmlTableReference, assignments, idTableSubQueryPredicate);
    final JdbcServices jdbcServices = sessionFactory.getJdbcServices();
    final JdbcUpdate jdbcUpdate = jdbcServices.getJdbcEnvironment().getSqlAstTranslatorFactory().buildUpdateTranslator(sessionFactory, sqlAst).translate(jdbcParameterBindings, executionContext.getQueryOptions());
    final int updateCount = jdbcServices.getJdbcMutationExecutor().execute(jdbcUpdate, jdbcParameterBindings, sql -> executionContext.getSession().getJdbcCoordinator().getStatementPreparer().prepareStatement(sql), (integer, preparedStatement) -> {
    }, executionContext);
    if (updateCount == expectedUpdateCount) {
        // We are done when the update count matches
        return;
    }
    // Otherwise we have to check if the table is nullable, and if so, insert into that table
    final AbstractEntityPersister entityPersister = (AbstractEntityPersister) entityDescriptor.getEntityPersister();
    boolean isNullable = false;
    for (int i = 0; i < entityPersister.getTableSpan(); i++) {
        if (tableExpression.equals(entityPersister.getTableName(i)) && entityPersister.isNullableTable(i)) {
            isNullable = true;
            break;
        }
    }
    if (isNullable) {
        // Copy the subquery contents into a root query
        final QuerySpec querySpec = new QuerySpec(true);
        for (TableGroup root : idTableSubQuery.getFromClause().getRoots()) {
            querySpec.getFromClause().addRoot(root);
        }
        for (SqlSelection sqlSelection : idTableSubQuery.getSelectClause().getSqlSelections()) {
            querySpec.getSelectClause().addSqlSelection(sqlSelection);
        }
        querySpec.applyPredicate(idTableSubQuery.getWhereClauseRestrictions());
        // Prepare a not exists sub-query to avoid violating constraints
        final QuerySpec existsQuerySpec = new QuerySpec(false);
        existsQuerySpec.getSelectClause().addSqlSelection(new SqlSelectionImpl(-1, 0, new QueryLiteral<>(1, sessionFactory.getTypeConfiguration().getBasicTypeForJavaType(Integer.class))));
        final NamedTableReference existsTableReference = new NamedTableReference(tableExpression, "dml_", false, sessionFactory);
        existsQuerySpec.getFromClause().addRoot(new TableGroupImpl(null, null, existsTableReference, entityPersister));
        final TableKeyExpressionCollector existsKeyColumnCollector = new TableKeyExpressionCollector(entityDescriptor);
        tableKeyColumnVisitationSupplier.get().accept((columnIndex, selection) -> {
            assert selection.getContainingTableExpression().equals(tableExpression);
            existsKeyColumnCollector.apply(new ColumnReference(existsTableReference, selection, sessionFactory));
        });
        existsQuerySpec.applyPredicate(new ComparisonPredicate(existsKeyColumnCollector.buildKeyExpression(), ComparisonOperator.EQUAL, asExpression(idTableSubQuery.getSelectClause())));
        querySpec.applyPredicate(new ExistsPredicate(existsQuerySpec, true, sessionFactory.getTypeConfiguration().getBasicTypeForJavaType(Boolean.class)));
        // Collect the target column references from the key expressions
        final List<ColumnReference> targetColumnReferences = new ArrayList<>();
        if (keyExpression instanceof SqlTuple) {
            // noinspection unchecked
            targetColumnReferences.addAll((Collection<? extends ColumnReference>) ((SqlTuple) keyExpression).getExpressions());
        } else {
            targetColumnReferences.add((ColumnReference) keyExpression);
        }
        // And transform assignments to target column references and selections
        for (Assignment assignment : assignments) {
            targetColumnReferences.addAll(assignment.getAssignable().getColumnReferences());
            querySpec.getSelectClause().addSqlSelection(new SqlSelectionImpl(0, -1, assignment.getAssignedValue()));
        }
        final InsertStatement insertSqlAst = new InsertStatement(dmlTableReference);
        insertSqlAst.addTargetColumnReferences(targetColumnReferences.toArray(new ColumnReference[0]));
        insertSqlAst.setSourceSelectStatement(querySpec);
        final JdbcInsert jdbcInsert = jdbcServices.getJdbcEnvironment().getSqlAstTranslatorFactory().buildInsertTranslator(sessionFactory, insertSqlAst).translate(jdbcParameterBindings, executionContext.getQueryOptions());
        final int insertCount = jdbcServices.getJdbcMutationExecutor().execute(jdbcInsert, jdbcParameterBindings, sql -> executionContext.getSession().getJdbcCoordinator().getStatementPreparer().prepareStatement(sql), (integer, preparedStatement) -> {
        }, executionContext);
        assert insertCount + updateCount == expectedUpdateCount;
    }
}
Also used : ExistsPredicate(org.hibernate.sql.ast.tree.predicate.ExistsPredicate) ArrayList(java.util.ArrayList) JdbcServices(org.hibernate.engine.jdbc.spi.JdbcServices) ComparisonPredicate(org.hibernate.sql.ast.tree.predicate.ComparisonPredicate) InsertStatement(org.hibernate.sql.ast.tree.insert.InsertStatement) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection) Assignment(org.hibernate.sql.ast.tree.update.Assignment) TableReference(org.hibernate.sql.ast.tree.from.TableReference) NamedTableReference(org.hibernate.sql.ast.tree.from.NamedTableReference) UnionTableReference(org.hibernate.sql.ast.tree.from.UnionTableReference) QueryLiteral(org.hibernate.sql.ast.tree.expression.QueryLiteral) JdbcUpdate(org.hibernate.sql.exec.spi.JdbcUpdate) TableGroupImpl(org.hibernate.query.results.TableGroupImpl) TableKeyExpressionCollector(org.hibernate.query.sqm.mutation.internal.TableKeyExpressionCollector) SqmUpdateStatement(org.hibernate.query.sqm.tree.update.SqmUpdateStatement) UpdateStatement(org.hibernate.sql.ast.tree.update.UpdateStatement) NamedTableReference(org.hibernate.sql.ast.tree.from.NamedTableReference) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) InSubQueryPredicate(org.hibernate.sql.ast.tree.predicate.InSubQueryPredicate) JdbcInsert(org.hibernate.sql.exec.spi.JdbcInsert) Expression(org.hibernate.sql.ast.tree.expression.Expression) SqlTuple(org.hibernate.sql.ast.tree.expression.SqlTuple) SqlSelectionImpl(org.hibernate.sql.results.internal.SqlSelectionImpl) QuerySpec(org.hibernate.sql.ast.tree.select.QuerySpec) AbstractEntityPersister(org.hibernate.persister.entity.AbstractEntityPersister) ColumnReference(org.hibernate.sql.ast.tree.expression.ColumnReference)

Example 49 with QuerySpec

use of org.hibernate.sql.ast.tree.select.QuerySpec in project hibernate-orm by hibernate.

the class UpdateExecutionDelegate method execute.

@Override
public int execute(ExecutionContext executionContext) {
    ExecuteWithTemporaryTableHelper.performBeforeTemporaryTableUseActions(idTable, executionContext);
    try {
        final int rows = ExecuteWithTemporaryTableHelper.saveMatchingIdsIntoIdTable(sqmConverter, suppliedPredicate, idTable, sessionUidAccess, jdbcParameterBindings, executionContext);
        final QuerySpec idTableSubQuery = ExecuteWithTemporaryTableHelper.createIdTableSelectQuerySpec(idTable, sessionUidAccess, entityDescriptor, executionContext);
        entityDescriptor.visitConstraintOrderedTables((tableExpression, tableKeyColumnVisitationSupplier) -> updateTable(tableExpression, tableKeyColumnVisitationSupplier, rows, idTableSubQuery, executionContext));
        return rows;
    } finally {
        ExecuteWithTemporaryTableHelper.performAfterTemporaryTableUseActions(idTable, sessionUidAccess, afterUseAction, executionContext);
    }
}
Also used : QuerySpec(org.hibernate.sql.ast.tree.select.QuerySpec)

Example 50 with QuerySpec

use of org.hibernate.sql.ast.tree.select.QuerySpec in project hibernate-orm by hibernate.

the class InsertExecutionDelegate method insertTable.

private void insertTable(String tableExpression, String[] keyColumns, boolean nullableTable, ExecutionContext executionContext) {
    final TableReference updatingTableReference = updatingTableGroup.getTableReference(updatingTableGroup.getNavigablePath(), tableExpression, true, true);
    final List<Assignment> assignments = assignmentsByTable.get(updatingTableReference);
    if (nullableTable && (assignments == null || assignments.isEmpty())) {
        // no assignments for this table - skip it
        return;
    }
    final NamedTableReference dmlTargetTableReference = resolveUnionTableReference(updatingTableReference, tableExpression);
    final QuerySpec querySpec = new QuerySpec(true);
    final TableGroupImpl temporaryTableGroup = new TableGroupImpl(updatingTableGroup.getNavigablePath(), null, new NamedTableReference(insertStatement.getTargetTable().getTableExpression(), updatingTableReference.getIdentificationVariable(), false, sessionFactory), entityDescriptor);
    querySpec.getFromClause().addRoot(temporaryTableGroup);
    final InsertStatement insertStatement = new InsertStatement(dmlTargetTableReference);
    insertStatement.setSourceSelectStatement(querySpec);
    if (assignments != null && !assignments.isEmpty()) {
        for (Assignment assignment : assignments) {
            insertStatement.addTargetColumnReferences(assignment.getAssignable().getColumnReferences());
            for (ColumnReference columnReference : assignment.getAssignable().getColumnReferences()) {
                querySpec.getSelectClause().addSqlSelection(new SqlSelectionImpl(1, 0, new ColumnReference(updatingTableReference.getIdentificationVariable(), columnReference.getColumnExpression(), false, null, null, columnReference.getJdbcMapping(), sessionFactory)));
            }
        }
    }
    final String targetKeyColumnName = keyColumns[0];
    final AbstractEntityPersister entityPersister = (AbstractEntityPersister) entityDescriptor.getEntityPersister();
    final IdentifierGenerator identifierGenerator = entityPersister.getIdentifierGenerator();
    final boolean needsKeyInsert;
    if (identifierGenerator instanceof PostInsertIdentifierGenerator) {
        needsKeyInsert = true;
    } else if (identifierGenerator instanceof OptimizableGenerator) {
        final Optimizer optimizer = ((OptimizableGenerator) identifierGenerator).getOptimizer();
        // If the generator uses an optimizer, we have to generate the identifiers for the new rows
        needsKeyInsert = optimizer != null && optimizer.getIncrementSize() > 1;
    } else {
        needsKeyInsert = true;
    }
    if (needsKeyInsert && insertStatement.getTargetColumnReferences().stream().noneMatch(c -> targetKeyColumnName.equals(c.getColumnExpression()))) {
        final BasicEntityIdentifierMapping identifierMapping = (BasicEntityIdentifierMapping) entityDescriptor.getIdentifierMapping();
        insertStatement.addTargetColumnReferences(new ColumnReference(dmlTargetTableReference.getIdentificationVariable(), targetKeyColumnName, false, null, null, identifierMapping.getJdbcMapping(), sessionFactory));
        querySpec.getSelectClause().addSqlSelection(new SqlSelectionImpl(1, 0, new ColumnReference(updatingTableReference.getIdentificationVariable(), identifierMapping, sessionFactory)));
    }
    final JdbcServices jdbcServices = sessionFactory.getJdbcServices();
    final JdbcInsert jdbcInsert = jdbcServices.getJdbcEnvironment().getSqlAstTranslatorFactory().buildInsertTranslator(sessionFactory, insertStatement).translate(null, executionContext.getQueryOptions());
    jdbcServices.getJdbcMutationExecutor().execute(jdbcInsert, JdbcParameterBindings.NO_BINDINGS, sql -> executionContext.getSession().getJdbcCoordinator().getStatementPreparer().prepareStatement(sql), (integer, preparedStatement) -> {
    }, executionContext);
}
Also used : CollectionHelper(org.hibernate.internal.util.collections.CollectionHelper) ExecutionContext(org.hibernate.sql.exec.spi.ExecutionContext) ValueBinder(org.hibernate.type.descriptor.ValueBinder) EntityMappingType(org.hibernate.metamodel.mapping.EntityMappingType) ComparisonPredicate(org.hibernate.sql.ast.tree.predicate.ComparisonPredicate) SqmUtil(org.hibernate.query.sqm.internal.SqmUtil) PostInsertIdentifierGenerator(org.hibernate.id.PostInsertIdentifierGenerator) Map(java.util.Map) JdbcParameterImpl(org.hibernate.sql.exec.internal.JdbcParameterImpl) Binder(org.hibernate.id.insert.Binder) ComparisonOperator(org.hibernate.query.sqm.ComparisonOperator) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) IdentifierGenerator(org.hibernate.id.IdentifierGenerator) Assignable(org.hibernate.sql.ast.tree.update.Assignable) Assignment(org.hibernate.sql.ast.tree.update.Assignment) Optimizer(org.hibernate.id.enhanced.Optimizer) PreparedStatement(java.sql.PreparedStatement) UpdateStatement(org.hibernate.sql.ast.tree.update.UpdateStatement) SelectStatement(org.hibernate.sql.ast.tree.select.SelectStatement) ArrayHelper(org.hibernate.internal.util.collections.ArrayHelper) List(java.util.List) JdbcUpdate(org.hibernate.sql.exec.spi.JdbcUpdate) SqmParameter(org.hibernate.query.sqm.tree.expression.SqmParameter) AbstractEntityPersister(org.hibernate.persister.entity.AbstractEntityPersister) InsertStatement(org.hibernate.sql.ast.tree.insert.InsertStatement) QuerySpec(org.hibernate.sql.ast.tree.select.QuerySpec) TemporaryTableColumn(org.hibernate.dialect.temptable.TemporaryTableColumn) MappingModelExpressible(org.hibernate.metamodel.mapping.MappingModelExpressible) SharedSessionContractImplementor(org.hibernate.engine.spi.SharedSessionContractImplementor) BasicEntityIdentifierMapping(org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping) JdbcParameterBindingsImpl(org.hibernate.sql.exec.internal.JdbcParameterBindingsImpl) TableGroupImpl(org.hibernate.query.results.TableGroupImpl) ColumnReference(org.hibernate.sql.ast.tree.expression.ColumnReference) OptimizableGenerator(org.hibernate.id.OptimizableGenerator) Function(java.util.function.Function) SemanticException(org.hibernate.query.SemanticException) SortOrder(org.hibernate.query.sqm.SortOrder) JdbcParameterBindings(org.hibernate.sql.exec.spi.JdbcParameterBindings) BasicFetch(org.hibernate.sql.results.graph.basic.BasicFetch) SortSpecification(org.hibernate.sql.ast.tree.select.SortSpecification) ArrayList(java.util.ArrayList) TableReference(org.hibernate.sql.ast.tree.from.TableReference) LinkedHashMap(java.util.LinkedHashMap) NamedTableReference(org.hibernate.sql.ast.tree.from.NamedTableReference) SQLException(java.sql.SQLException) MultiTableSqmMutationConverter(org.hibernate.query.sqm.mutation.internal.MultiTableSqmMutationConverter) JdbcInsert(org.hibernate.sql.exec.spi.JdbcInsert) SqmParameterMappingModelResolutionAccess(org.hibernate.query.sqm.spi.SqmParameterMappingModelResolutionAccess) UnionTableReference(org.hibernate.sql.ast.tree.from.UnionTableReference) PostInsertIdentityPersister(org.hibernate.id.PostInsertIdentityPersister) FetchTiming(org.hibernate.engine.FetchTiming) InsertGeneratedIdentifierDelegate(org.hibernate.id.insert.InsertGeneratedIdentifierDelegate) TemporaryTable(org.hibernate.dialect.temptable.TemporaryTable) ListResultsConsumer(org.hibernate.sql.results.spi.ListResultsConsumer) ModelPartContainer(org.hibernate.metamodel.mapping.ModelPartContainer) JdbcServices(org.hibernate.engine.jdbc.spi.JdbcServices) DomainQueryExecutionContext(org.hibernate.query.spi.DomainQueryExecutionContext) JdbcParameter(org.hibernate.sql.ast.tree.expression.JdbcParameter) JdbcParameterBindingImpl(org.hibernate.sql.exec.internal.JdbcParameterBindingImpl) SqmInsertStatement(org.hibernate.query.sqm.tree.insert.SqmInsertStatement) SqlSelectionImpl(org.hibernate.sql.results.internal.SqlSelectionImpl) DomainParameterXref(org.hibernate.query.sqm.internal.DomainParameterXref) Collections(java.util.Collections) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) JdbcSelect(org.hibernate.sql.exec.spi.JdbcSelect) NamedTableReference(org.hibernate.sql.ast.tree.from.NamedTableReference) OptimizableGenerator(org.hibernate.id.OptimizableGenerator) Optimizer(org.hibernate.id.enhanced.Optimizer) JdbcServices(org.hibernate.engine.jdbc.spi.JdbcServices) BasicEntityIdentifierMapping(org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping) InsertStatement(org.hibernate.sql.ast.tree.insert.InsertStatement) SqmInsertStatement(org.hibernate.query.sqm.tree.insert.SqmInsertStatement) Assignment(org.hibernate.sql.ast.tree.update.Assignment) PostInsertIdentifierGenerator(org.hibernate.id.PostInsertIdentifierGenerator) TableReference(org.hibernate.sql.ast.tree.from.TableReference) NamedTableReference(org.hibernate.sql.ast.tree.from.NamedTableReference) UnionTableReference(org.hibernate.sql.ast.tree.from.UnionTableReference) JdbcInsert(org.hibernate.sql.exec.spi.JdbcInsert) SqlSelectionImpl(org.hibernate.sql.results.internal.SqlSelectionImpl) TableGroupImpl(org.hibernate.query.results.TableGroupImpl) QuerySpec(org.hibernate.sql.ast.tree.select.QuerySpec) AbstractEntityPersister(org.hibernate.persister.entity.AbstractEntityPersister) ColumnReference(org.hibernate.sql.ast.tree.expression.ColumnReference) PostInsertIdentifierGenerator(org.hibernate.id.PostInsertIdentifierGenerator) IdentifierGenerator(org.hibernate.id.IdentifierGenerator)

Aggregations

QuerySpec (org.hibernate.sql.ast.tree.select.QuerySpec)55 TableGroup (org.hibernate.sql.ast.tree.from.TableGroup)33 SqlSelectionImpl (org.hibernate.sql.results.internal.SqlSelectionImpl)28 ColumnReference (org.hibernate.sql.ast.tree.expression.ColumnReference)24 Expression (org.hibernate.sql.ast.tree.expression.Expression)24 NavigablePath (org.hibernate.spi.NavigablePath)23 ArrayList (java.util.ArrayList)22 NamedTableReference (org.hibernate.sql.ast.tree.from.NamedTableReference)19 TableReference (org.hibernate.sql.ast.tree.from.TableReference)19 ComparisonPredicate (org.hibernate.sql.ast.tree.predicate.ComparisonPredicate)19 SelectStatement (org.hibernate.sql.ast.tree.select.SelectStatement)19 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)18 PluralAttributeMapping (org.hibernate.metamodel.mapping.PluralAttributeMapping)16 PluralTableGroup (org.hibernate.sql.ast.tree.from.PluralTableGroup)16 InSubQueryPredicate (org.hibernate.sql.ast.tree.predicate.InSubQueryPredicate)16 List (java.util.List)15 SqlTuple (org.hibernate.sql.ast.tree.expression.SqlTuple)14 TableGroupJoin (org.hibernate.sql.ast.tree.from.TableGroupJoin)14 Map (java.util.Map)13 Collections (java.util.Collections)12