Search in sources :

Example 1 with EntityResultImpl

use of org.hibernate.sql.results.graph.entity.internal.EntityResultImpl in project hibernate-orm by hibernate.

the class AbstractEntityPersister method createDomainResult.

@Override
public <T> DomainResult<T> createDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState) {
    final EntityResultImpl entityResult = new EntityResultImpl(navigablePath, this, tableGroup, resultVariable, creationState);
    entityResult.afterInitialize(entityResult, creationState);
    // noinspection unchecked
    return entityResult;
}
Also used : EntityResultImpl(org.hibernate.sql.results.graph.entity.internal.EntityResultImpl)

Example 2 with EntityResultImpl

use of org.hibernate.sql.results.graph.entity.internal.EntityResultImpl in project hibernate-orm by hibernate.

the class ToOneAttributeMapping method createDelayedDomainResult.

@Override
public <T> DomainResult<T> createDelayedDomainResult(NavigablePath navigablePath, TableGroup tableGroup, String resultVariable, DomainResultCreationState creationState) {
    // and if the FK refers to a non-PK, in which case we must load the whole entity
    if (sideNature == ForeignKeyDescriptor.Nature.TARGET || referencedPropertyName != null) {
        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();
        });
    }
    if (referencedPropertyName == null) {
        return new EntityDelayedResultImpl(navigablePath.append(EntityIdentifierMapping.ROLE_LOCAL_NAME), this, tableGroup, 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, tableGroup, null, creationState);
        entityResult.afterInitialize(entityResult, creationState);
        // noinspection unchecked
        return entityResult;
    }
}
Also used : TableGroupJoin(org.hibernate.sql.ast.tree.from.TableGroupJoin) EntityResultImpl(org.hibernate.sql.results.graph.entity.internal.EntityResultImpl) EntityDelayedResultImpl(org.hibernate.sql.results.graph.entity.internal.EntityDelayedResultImpl)

Aggregations

EntityResultImpl (org.hibernate.sql.results.graph.entity.internal.EntityResultImpl)2 TableGroupJoin (org.hibernate.sql.ast.tree.from.TableGroupJoin)1 EntityDelayedResultImpl (org.hibernate.sql.results.graph.entity.internal.EntityDelayedResultImpl)1