Search in sources :

Example 6 with DomainResult

use of org.hibernate.sql.results.graph.DomainResult in project hibernate-orm by hibernate.

the class ToOneAttributeMapping method createSnapshotDomainResult.

@Override
public <T> DomainResult<T> createSnapshotDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState) {
    // We need a join if either
    // - the association is mapped with `@NotFound`
    // - the key is on the referring side i.e. this is an inverse to-one
    // and if the FK refers to a non-PK
    final boolean forceJoin = hasNotFoundAction() || sideNature == ForeignKeyDescriptor.Nature.TARGET || referencedPropertyName != null;
    final TableGroup tableGroupToUse;
    if (forceJoin) {
        tableGroupToUse = creationState.getSqlAstCreationState().getFromClauseAccess().resolveTableGroup(navigablePath, np -> {
            final TableGroupJoin tableGroupJoin = createTableGroupJoin(navigablePath, tableGroup, null, getDefaultSqlAstJoinType(tableGroup), true, false, creationState.getSqlAstCreationState());
            tableGroup.addTableGroupJoin(tableGroupJoin);
            return tableGroupJoin.getJoinedGroup();
        });
    } else {
        tableGroupToUse = tableGroup;
    }
    if (hasNotFoundAction()) {
        assert tableGroupToUse != tableGroup;
        // noinspection unchecked
        return new NotFoundSnapshotResult(navigablePath, this, tableGroupToUse, tableGroup, creationState);
    }
    if (referencedPropertyName == null) {
        // noinspection unchecked
        return new EntityDelayedResultImpl(navigablePath.append(EntityIdentifierMapping.ROLE_LOCAL_NAME), this, tableGroupToUse, creationState);
    } else {
        // We don't support proxies based on a non-PK yet, so we must fetch the whole entity
        final EntityResultImpl entityResult = new EntityResultImpl(navigablePath, this, tableGroupToUse, null, creationState);
        entityResult.afterInitialize(entityResult, creationState);
        // noinspection unchecked
        return entityResult;
    }
}
Also used : Arrays(java.util.Arrays) EntityPersister(org.hibernate.persister.entity.EntityPersister) Property(org.hibernate.mapping.Property) TreatedNavigablePath(org.hibernate.spi.TreatedNavigablePath) TableGroupJoin(org.hibernate.sql.ast.tree.from.TableGroupJoin) PropertyAccess(org.hibernate.property.access.spi.PropertyAccess) EntityResultImpl(org.hibernate.sql.results.graph.entity.internal.EntityResultImpl) EntityMappingType(org.hibernate.metamodel.mapping.EntityMappingType) ToOne(org.hibernate.mapping.ToOne) SqlAstCreationContext(org.hibernate.sql.ast.spi.SqlAstCreationContext) PluralAttributeMapping(org.hibernate.metamodel.mapping.PluralAttributeMapping) EntityAssociationMapping(org.hibernate.metamodel.mapping.EntityAssociationMapping) ForeignKeyDescriptor(org.hibernate.metamodel.mapping.ForeignKeyDescriptor) PersistentClass(org.hibernate.mapping.PersistentClass) FetchOptions(org.hibernate.sql.results.graph.FetchOptions) Join(org.hibernate.mapping.Join) TableGroupProducer(org.hibernate.sql.ast.tree.from.TableGroupProducer) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) EntityDelayedResultImpl(org.hibernate.sql.results.graph.entity.internal.EntityDelayedResultImpl) CollectionPart(org.hibernate.metamodel.mapping.CollectionPart) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection) CorrelatedTableGroup(org.hibernate.sql.ast.tree.from.CorrelatedTableGroup) EntityValuedFetchable(org.hibernate.sql.results.graph.entity.EntityValuedFetchable) EntityDelayedFetchImpl(org.hibernate.sql.results.graph.entity.internal.EntityDelayedFetchImpl) MappedByTableGroup(org.hibernate.sql.ast.tree.from.MappedByTableGroup) TableGroupJoinProducer(org.hibernate.sql.ast.tree.from.TableGroupJoinProducer) AttributeMetadataAccess(org.hibernate.metamodel.mapping.AttributeMetadataAccess) LazyTableGroup(org.hibernate.sql.ast.tree.from.LazyTableGroup) OneToOne(org.hibernate.mapping.OneToOne) VirtualModelPart(org.hibernate.metamodel.mapping.VirtualModelPart) NotFoundSnapshotResult(org.hibernate.sql.results.graph.entity.internal.NotFoundSnapshotResult) StringHelper(org.hibernate.internal.util.StringHelper) DomainResult(org.hibernate.sql.results.graph.DomainResult) Set(java.util.Set) Value(org.hibernate.mapping.Value) Collection(org.hibernate.mapping.Collection) NavigablePath(org.hibernate.spi.NavigablePath) SqlAliasBase(org.hibernate.sql.ast.spi.SqlAliasBase) SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) EntityIdentifierMapping(org.hibernate.metamodel.mapping.EntityIdentifierMapping) NavigableRole(org.hibernate.metamodel.model.domain.NavigableRole) ArrayHelper(org.hibernate.internal.util.collections.ArrayHelper) EntityIdentifierNavigablePath(org.hibernate.spi.EntityIdentifierNavigablePath) CircularBiDirectionalFetchImpl(org.hibernate.sql.results.internal.domain.CircularBiDirectionalFetchImpl) AbstractEntityPersister(org.hibernate.persister.entity.AbstractEntityPersister) SelectableConsumer(org.hibernate.metamodel.mapping.SelectableConsumer) SharedSessionContractImplementor(org.hibernate.engine.spi.SharedSessionContractImplementor) IndexedConsumer(org.hibernate.mapping.IndexedConsumer) FetchParent(org.hibernate.sql.results.graph.FetchParent) CircularFetchImpl(org.hibernate.sql.results.internal.domain.CircularFetchImpl) DomainResultCreationState(org.hibernate.sql.results.graph.DomainResultCreationState) SqlAliasBaseGenerator(org.hibernate.sql.ast.spi.SqlAliasBaseGenerator) EntityFetchSelectImpl(org.hibernate.sql.results.graph.entity.internal.EntityFetchSelectImpl) JdbcMapping(org.hibernate.metamodel.mapping.JdbcMapping) EntityResultJoinedSubclassImpl(org.hibernate.sql.results.graph.entity.internal.EntityResultJoinedSubclassImpl) SqlAliasStemHelper(org.hibernate.sql.ast.spi.SqlAliasStemHelper) EmbeddedComponentType(org.hibernate.type.EmbeddedComponentType) EntityType(org.hibernate.type.EntityType) Clause(org.hibernate.sql.ast.Clause) Supplier(java.util.function.Supplier) Objects.requireNonNullElse(java.util.Objects.requireNonNullElse) MappingType(org.hibernate.metamodel.mapping.MappingType) TableReference(org.hibernate.sql.ast.tree.from.TableReference) HashSet(java.util.HashSet) ModelPart(org.hibernate.metamodel.mapping.ModelPart) ComponentType(org.hibernate.type.ComponentType) CompositeType(org.hibernate.type.CompositeType) BiConsumer(java.util.function.BiConsumer) ManagedMappingType(org.hibernate.metamodel.mapping.ManagedMappingType) StandardTableGroup(org.hibernate.sql.ast.tree.from.StandardTableGroup) SqlAstCreationState(org.hibernate.sql.ast.spi.SqlAstCreationState) FetchTiming(org.hibernate.engine.FetchTiming) ManyToOne(org.hibernate.mapping.ManyToOne) LockMode(org.hibernate.LockMode) AssociationKey(org.hibernate.metamodel.mapping.AssociationKey) Predicate(org.hibernate.sql.ast.tree.predicate.Predicate) Iterator(java.util.Iterator) ModelPartContainer(org.hibernate.metamodel.mapping.ModelPartContainer) EmbeddableValuedFetchable(org.hibernate.sql.results.graph.embeddable.EmbeddableValuedFetchable) Fetch(org.hibernate.sql.results.graph.Fetch) Consumer(java.util.function.Consumer) QueryableCollection(org.hibernate.persister.collection.QueryableCollection) EntityFetch(org.hibernate.sql.results.graph.entity.EntityFetch) FetchStyle(org.hibernate.engine.FetchStyle) FromClauseAccess(org.hibernate.sql.ast.spi.FromClauseAccess) SqlAstJoinType(org.hibernate.sql.ast.SqlAstJoinType) NotFoundAction(org.hibernate.annotations.NotFoundAction) Selectable(org.hibernate.mapping.Selectable) EmbeddableValuedModelPart(org.hibernate.metamodel.mapping.EmbeddableValuedModelPart) Collections(java.util.Collections) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) PluralTableGroup(org.hibernate.sql.ast.tree.from.PluralTableGroup) EntityFetchJoinedImpl(org.hibernate.sql.results.graph.entity.internal.EntityFetchJoinedImpl) Type(org.hibernate.type.Type) TableGroupJoin(org.hibernate.sql.ast.tree.from.TableGroupJoin) CorrelatedTableGroup(org.hibernate.sql.ast.tree.from.CorrelatedTableGroup) MappedByTableGroup(org.hibernate.sql.ast.tree.from.MappedByTableGroup) LazyTableGroup(org.hibernate.sql.ast.tree.from.LazyTableGroup) StandardTableGroup(org.hibernate.sql.ast.tree.from.StandardTableGroup) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) PluralTableGroup(org.hibernate.sql.ast.tree.from.PluralTableGroup) EntityResultImpl(org.hibernate.sql.results.graph.entity.internal.EntityResultImpl) NotFoundSnapshotResult(org.hibernate.sql.results.graph.entity.internal.NotFoundSnapshotResult) EntityDelayedResultImpl(org.hibernate.sql.results.graph.entity.internal.EntityDelayedResultImpl)

Example 7 with DomainResult

use of org.hibernate.sql.results.graph.DomainResult in project hibernate-orm by hibernate.

the class CollectionIdentifierDescriptorImpl method createDomainResult.

public DomainResult<?> createDomainResult(NavigablePath collectionPath, TableGroup tableGroup, DomainResultCreationState creationState) {
    final SqlAstCreationState astCreationState = creationState.getSqlAstCreationState();
    final SqlAstCreationContext astCreationContext = astCreationState.getCreationContext();
    final SessionFactoryImplementor sessionFactory = astCreationContext.getSessionFactory();
    final SqlExpressionResolver sqlExpressionResolver = astCreationState.getSqlExpressionResolver();
    final SqlSelection sqlSelection = sqlExpressionResolver.resolveSqlSelection(sqlExpressionResolver.resolveSqlExpression(SqlExpressionResolver.createColumnReferenceKey(tableGroup.getPrimaryTableReference(), columnName), p -> new ColumnReference(tableGroup.getPrimaryTableReference().getIdentificationVariable(), columnName, false, null, null, type, sessionFactory)), type.getJavaTypeDescriptor(), null, sessionFactory.getTypeConfiguration());
    // noinspection unchecked
    return new BasicResult<>(sqlSelection.getValuesArrayPosition(), null, (JavaType<Object>) type.getJavaTypeDescriptor(), collectionPath);
}
Also used : DomainResultCreationState(org.hibernate.sql.results.graph.DomainResultCreationState) JdbcMapping(org.hibernate.metamodel.mapping.JdbcMapping) BasicType(org.hibernate.type.BasicType) ColumnReference(org.hibernate.sql.ast.tree.expression.ColumnReference) JavaType(org.hibernate.type.descriptor.java.JavaType) CollectionIdentifierDescriptor(org.hibernate.metamodel.mapping.CollectionIdentifierDescriptor) Clause(org.hibernate.sql.ast.Clause) BasicFetch(org.hibernate.sql.results.graph.basic.BasicFetch) EntityMappingType(org.hibernate.metamodel.mapping.EntityMappingType) MappingType(org.hibernate.metamodel.mapping.MappingType) SqlAstCreationContext(org.hibernate.sql.ast.spi.SqlAstCreationContext) FetchOptions(org.hibernate.sql.results.graph.FetchOptions) BiConsumer(java.util.function.BiConsumer) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection) SqlAstCreationState(org.hibernate.sql.ast.spi.SqlAstCreationState) FetchTiming(org.hibernate.engine.FetchTiming) DomainResult(org.hibernate.sql.results.graph.DomainResult) NavigablePath(org.hibernate.spi.NavigablePath) 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) FromClauseAccess(org.hibernate.sql.ast.spi.FromClauseAccess) CollectionPersister(org.hibernate.persister.collection.CollectionPersister) 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) SqlAstCreationContext(org.hibernate.sql.ast.spi.SqlAstCreationContext) SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) BasicResult(org.hibernate.sql.results.graph.basic.BasicResult) SqlAstCreationState(org.hibernate.sql.ast.spi.SqlAstCreationState) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection) ColumnReference(org.hibernate.sql.ast.tree.expression.ColumnReference)

Example 8 with DomainResult

use of org.hibernate.sql.results.graph.DomainResult in project hibernate-orm by hibernate.

the class CompoundNaturalIdMapping method createDomainResult.

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ModelPart
@Override
public <T> DomainResult<T> createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState) {
    assert navigablePath.getLocalName().equals(NaturalIdMapping.PART_NAME);
    final SessionFactoryImplementor sessionFactory = creationState.getSqlAstCreationState().getCreationContext().getSessionFactory();
    final JavaType<Object[]> jtd = sessionFactory.getTypeConfiguration().getJavaTypeRegistry().getDescriptor(Object[].class);
    // register the table group under `...{natural-id}` as well
    creationState.getSqlAstCreationState().getFromClauseAccess().resolveTableGroup(navigablePath, (np) -> tableGroup);
    return (DomainResult<T>) new DomainResultImpl(navigablePath, this, jtd, resultVariable, creationState);
}
Also used : SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) DomainResult(org.hibernate.sql.results.graph.DomainResult)

Example 9 with DomainResult

use of org.hibernate.sql.results.graph.DomainResult in project hibernate-orm by hibernate.

the class LoaderSelectBuilder method generateSelect.

private SelectStatement generateSelect() {
    if (loadable instanceof PluralAttributeMapping) {
        final PluralAttributeMapping pluralAttributeMapping = (PluralAttributeMapping) loadable;
        if (pluralAttributeMapping.getMappedType().getCollectionSemantics() instanceof BagSemantics) {
            currentBagRole = pluralAttributeMapping.getNavigableRole().getNavigableName();
        }
    }
    final NavigablePath rootNavigablePath = new NavigablePath(loadable.getRootPathName());
    final QuerySpec rootQuerySpec = new QuerySpec(true);
    final List<DomainResult<?>> domainResults;
    final LoaderSqlAstCreationState sqlAstCreationState = new LoaderSqlAstCreationState(rootQuerySpec, new SqlAliasBaseManager(), new SimpleFromClauseAccessImpl(), lockOptions, this::visitFetches, forceIdentifierSelection, creationContext);
    final TableGroup rootTableGroup = loadable.createRootTableGroup(true, rootNavigablePath, null, () -> rootQuerySpec::applyPredicate, sqlAstCreationState, creationContext);
    rootQuerySpec.getFromClause().addRoot(rootTableGroup);
    sqlAstCreationState.getFromClauseAccess().registerTableGroup(rootNavigablePath, rootTableGroup);
    registerPluralTableGroupParts(sqlAstCreationState.getFromClauseAccess(), rootTableGroup);
    if (partsToSelect != null && !partsToSelect.isEmpty()) {
        domainResults = new ArrayList<>(partsToSelect.size());
        for (ModelPart part : partsToSelect) {
            final NavigablePath navigablePath = rootNavigablePath.append(part.getPartName());
            final TableGroup tableGroup;
            if (part instanceof TableGroupJoinProducer) {
                final TableGroupJoinProducer tableGroupJoinProducer = (TableGroupJoinProducer) part;
                final TableGroupJoin tableGroupJoin = tableGroupJoinProducer.createTableGroupJoin(navigablePath, rootTableGroup, null, SqlAstJoinType.LEFT, true, false, sqlAstCreationState);
                rootTableGroup.addTableGroupJoin(tableGroupJoin);
                tableGroup = tableGroupJoin.getJoinedGroup();
                sqlAstCreationState.getFromClauseAccess().registerTableGroup(navigablePath, tableGroup);
                registerPluralTableGroupParts(sqlAstCreationState.getFromClauseAccess(), tableGroup);
            } else {
                tableGroup = rootTableGroup;
            }
            domainResults.add(part.createDomainResult(navigablePath, tableGroup, null, sqlAstCreationState));
        }
    } else {
        // use the one passed to the constructor or create one (maybe always create and pass?)
        // allows re-use as they can be re-used to save on memory - they
        // do not share state between
        // noinspection rawtypes
        final DomainResult domainResult;
        if (this.cachedDomainResult != null) {
            // used the one passed to the constructor
            domainResult = this.cachedDomainResult;
        } else {
            // create one
            domainResult = loadable.createDomainResult(rootNavigablePath, rootTableGroup, null, sqlAstCreationState);
        }
        // noinspection unchecked
        domainResults = Collections.singletonList(domainResult);
    }
    for (ModelPart restrictedPart : restrictedParts) {
        final int numberOfRestrictionColumns = restrictedPart.getJdbcTypeCount();
        applyRestriction(rootQuerySpec, rootNavigablePath, rootTableGroup, restrictedPart, numberOfRestrictionColumns, jdbcParameterConsumer, sqlAstCreationState);
    }
    if (loadable instanceof PluralAttributeMapping) {
        final PluralAttributeMapping pluralAttributeMapping = (PluralAttributeMapping) loadable;
        applyFiltering(rootQuerySpec, rootTableGroup, pluralAttributeMapping, sqlAstCreationState);
        applyOrdering(rootTableGroup, pluralAttributeMapping);
    } else {
        applyFiltering(rootQuerySpec, rootTableGroup, (Restrictable) loadable, sqlAstCreationState);
    }
    if (orderByFragments != null) {
        orderByFragments.forEach(entry -> entry.getKey().apply(rootQuerySpec, entry.getValue(), sqlAstCreationState));
    }
    return new SelectStatement(rootQuerySpec, domainResults);
}
Also used : NavigablePath(org.hibernate.spi.NavigablePath) EntityIdentifierNavigablePath(org.hibernate.spi.EntityIdentifierNavigablePath) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) PluralTableGroup(org.hibernate.sql.ast.tree.from.PluralTableGroup) TableGroupJoinProducer(org.hibernate.sql.ast.tree.from.TableGroupJoinProducer) EntityValuedModelPart(org.hibernate.metamodel.mapping.EntityValuedModelPart) BasicValuedModelPart(org.hibernate.metamodel.mapping.BasicValuedModelPart) ModelPart(org.hibernate.metamodel.mapping.ModelPart) PluralAttributeMapping(org.hibernate.metamodel.mapping.PluralAttributeMapping) CollectionDomainResult(org.hibernate.sql.results.graph.collection.internal.CollectionDomainResult) DomainResult(org.hibernate.sql.results.graph.DomainResult) SimpleFromClauseAccessImpl(org.hibernate.sql.ast.spi.SimpleFromClauseAccessImpl) SqlAliasBaseManager(org.hibernate.sql.ast.spi.SqlAliasBaseManager) TableGroupJoin(org.hibernate.sql.ast.tree.from.TableGroupJoin) SelectStatement(org.hibernate.sql.ast.tree.select.SelectStatement) BagSemantics(org.hibernate.collection.spi.BagSemantics) QuerySpec(org.hibernate.sql.ast.tree.select.QuerySpec)

Example 10 with DomainResult

use of org.hibernate.sql.results.graph.DomainResult in project hibernate-orm by hibernate.

the class JdbcSelectExecutorStandardImpl method doExecuteQuery.

private <T, R> T doExecuteQuery(JdbcSelect jdbcSelect, JdbcParameterBindings jdbcParameterBindings, ExecutionContext executionContext, RowTransformer<R> rowTransformer, Class<R> domainResultType, Function<String, PreparedStatement> statementCreator, ResultsConsumer<T, R> resultsConsumer) {
    final DeferredResultSetAccess deferredResultSetAccess = new DeferredResultSetAccess(jdbcSelect, jdbcParameterBindings, executionContext, statementCreator);
    final JdbcValues jdbcValues = resolveJdbcValuesSource(executionContext.getQueryIdentifier(deferredResultSetAccess.getFinalSql()), jdbcSelect, resultsConsumer.canResultsBeCached(), executionContext, deferredResultSetAccess);
    if (rowTransformer == null) {
        @SuppressWarnings("unchecked") final TupleTransformer<R> tupleTransformer = (TupleTransformer<R>) executionContext.getQueryOptions().getTupleTransformer();
        if (tupleTransformer == null) {
            rowTransformer = RowTransformerStandardImpl.instance();
        } else {
            final List<DomainResult<?>> domainResults = jdbcValues.getValuesMapping().getDomainResults();
            final String[] aliases = new String[domainResults.size()];
            for (int i = 0; i < domainResults.size(); i++) {
                aliases[i] = domainResults.get(i).getResultVariable();
            }
            rowTransformer = new RowTransformerTupleTransformerAdapter<>(aliases, tupleTransformer);
        }
    }
    final boolean stats;
    long startTime = 0;
    final StatisticsImplementor statistics = executionContext.getSession().getFactory().getStatistics();
    if (executionContext.hasQueryExecutionToBeAddedToStatistics() && jdbcValues instanceof JdbcValuesResultSetImpl) {
        stats = statistics.isStatisticsEnabled();
        if (stats) {
            startTime = System.nanoTime();
        }
    } else {
        stats = false;
    }
    /*
		 * Processing options effectively are only used for entity loading.  Here we don't need these values.
		 */
    final JdbcValuesSourceProcessingOptions processingOptions = new JdbcValuesSourceProcessingOptions() {

        @Override
        public Object getEffectiveOptionalObject() {
            return executionContext.getEntityInstance();
        }

        @Override
        public String getEffectiveOptionalEntityName() {
            return null;
        }

        @Override
        public Object getEffectiveOptionalId() {
            return executionContext.getEntityId();
        }

        @Override
        public boolean shouldReturnProxies() {
            return true;
        }
    };
    final JdbcValuesSourceProcessingStateStandardImpl valuesProcessingState = new JdbcValuesSourceProcessingStateStandardImpl(executionContext, processingOptions, executionContext::registerLoadingEntityEntry);
    final RowReader<R> rowReader = ResultsHelper.createRowReader(executionContext, // because the EntityEntrys would already have the desired lock mode
    deferredResultSetAccess.usesFollowOnLocking() ? LockOptions.NONE : executionContext.getQueryOptions().getLockOptions(), rowTransformer, domainResultType, jdbcValues);
    final RowProcessingStateStandardImpl rowProcessingState = new RowProcessingStateStandardImpl(valuesProcessingState, executionContext, rowReader, jdbcValues);
    final T result = resultsConsumer.consume(jdbcValues, executionContext.getSession(), processingOptions, valuesProcessingState, rowProcessingState, rowReader);
    if (stats) {
        final long endTime = System.nanoTime();
        final long milliseconds = TimeUnit.MILLISECONDS.convert(endTime - startTime, TimeUnit.NANOSECONDS);
        statistics.queryExecuted(executionContext.getQueryIdentifier(jdbcSelect.getSql()), getResultSize(result), milliseconds);
    }
    return result;
}
Also used : JdbcValuesSourceProcessingOptions(org.hibernate.sql.results.jdbc.spi.JdbcValuesSourceProcessingOptions) JdbcValues(org.hibernate.sql.results.jdbc.spi.JdbcValues) DeferredResultSetAccess(org.hibernate.sql.results.jdbc.internal.DeferredResultSetAccess) DomainResult(org.hibernate.sql.results.graph.DomainResult) StatisticsImplementor(org.hibernate.stat.spi.StatisticsImplementor) JdbcValuesResultSetImpl(org.hibernate.sql.results.jdbc.internal.JdbcValuesResultSetImpl) TupleTransformer(org.hibernate.query.TupleTransformer) JdbcValuesSourceProcessingStateStandardImpl(org.hibernate.sql.results.jdbc.internal.JdbcValuesSourceProcessingStateStandardImpl) RowProcessingStateStandardImpl(org.hibernate.sql.results.internal.RowProcessingStateStandardImpl)

Aggregations

DomainResult (org.hibernate.sql.results.graph.DomainResult)22 Fetch (org.hibernate.sql.results.graph.Fetch)11 TableGroup (org.hibernate.sql.ast.tree.from.TableGroup)9 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)8 EntityMappingType (org.hibernate.metamodel.mapping.EntityMappingType)7 SqlSelection (org.hibernate.sql.ast.spi.SqlSelection)7 EntityResult (org.hibernate.sql.results.graph.entity.EntityResult)7 BiConsumer (java.util.function.BiConsumer)6 JdbcMapping (org.hibernate.metamodel.mapping.JdbcMapping)6 SqlExpressionResolver (org.hibernate.sql.ast.spi.SqlExpressionResolver)6 SelectStatement (org.hibernate.sql.ast.tree.select.SelectStatement)6 DomainResultCreationState (org.hibernate.sql.results.graph.DomainResultCreationState)6 BasicResult (org.hibernate.sql.results.graph.basic.BasicResult)6 SharedSessionContractImplementor (org.hibernate.engine.spi.SharedSessionContractImplementor)5 IndexedConsumer (org.hibernate.mapping.IndexedConsumer)5 MappingType (org.hibernate.metamodel.mapping.MappingType)5 NavigableRole (org.hibernate.metamodel.model.domain.NavigableRole)5 EntityPersister (org.hibernate.persister.entity.EntityPersister)5 NavigablePath (org.hibernate.spi.NavigablePath)5 Clause (org.hibernate.sql.ast.Clause)5