Search in sources :

Example 1 with EmbeddableResult

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

the class ImplicitModelPartResultBuilderEmbeddable method buildResult.

@Override
public EmbeddableResult buildResult(JdbcValuesMetadata jdbcResultsMetadata, int resultPosition, BiFunction<String, String, DynamicFetchBuilderLegacy> legacyFetchResolver, DomainResultCreationState domainResultCreationState) {
    final DomainResultCreationStateImpl creationStateImpl = ResultsHelper.impl(domainResultCreationState);
    creationStateImpl.disallowPositionalSelections();
    final TableGroup tableGroup = creationStateImpl.getFromClauseAccess().resolveTableGroup(navigablePath, np -> {
        if (navigablePath.getParent() == null) {
            throw new IllegalStateException("Could not determine LHS for implicit embeddable result builder - " + navigablePath);
        }
        final TableGroup parentTableGroup = creationStateImpl.getFromClauseAccess().getTableGroup(navigablePath.getParent());
        final TableGroupJoin tableGroupJoin = modelPart.createTableGroupJoin(navigablePath, parentTableGroup, null, SqlAstJoinType.INNER, true, false, creationStateImpl);
        parentTableGroup.addTableGroupJoin(tableGroupJoin);
        return tableGroupJoin.getJoinedGroup();
    });
    return (EmbeddableResult) modelPart.createDomainResult(navigablePath, tableGroup, null, domainResultCreationState);
}
Also used : TableGroupJoin(org.hibernate.sql.ast.tree.from.TableGroupJoin) DomainResultCreationStateImpl(org.hibernate.query.results.DomainResultCreationStateImpl) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) EmbeddableResult(org.hibernate.sql.results.graph.embeddable.EmbeddableResult)

Aggregations

DomainResultCreationStateImpl (org.hibernate.query.results.DomainResultCreationStateImpl)1 TableGroup (org.hibernate.sql.ast.tree.from.TableGroup)1 TableGroupJoin (org.hibernate.sql.ast.tree.from.TableGroupJoin)1 EmbeddableResult (org.hibernate.sql.results.graph.embeddable.EmbeddableResult)1