Search in sources :

Example 1 with DelayedCollectionFetch

use of org.hibernate.sql.results.graph.collection.internal.DelayedCollectionFetch in project hibernate-orm by hibernate.

the class PluralAttributeMappingImpl method createDelayedCollectionFetch.

private Fetch createDelayedCollectionFetch(FetchParent fetchParent, NavigablePath fetchablePath, DomainResultCreationState creationState, SqlAstCreationState sqlAstCreationState) {
    final DomainResult<?> collectionKeyDomainResult;
    // Lazy property. A null foreign key domain result will lead to
    // returning a domain result assembler that returns LazyPropertyInitializer.UNFETCHED_PROPERTY
    final EntityMappingType containingEntityMapping = findContainingEntityMapping();
    if (fetchParent.getReferencedModePart() == containingEntityMapping && containingEntityMapping.getEntityPersister().getPropertyLaziness()[getStateArrayPosition()]) {
        collectionKeyDomainResult = null;
    } else {
        collectionKeyDomainResult = getKeyDescriptor().createTargetDomainResult(fetchablePath, sqlAstCreationState.getFromClauseAccess().getTableGroup(fetchParent.getNavigablePath()), creationState);
    }
    return new DelayedCollectionFetch(fetchablePath, this, fetchParent, collectionKeyDomainResult);
}
Also used : DelayedCollectionFetch(org.hibernate.sql.results.graph.collection.internal.DelayedCollectionFetch) EntityMappingType(org.hibernate.metamodel.mapping.EntityMappingType)

Aggregations

EntityMappingType (org.hibernate.metamodel.mapping.EntityMappingType)1 DelayedCollectionFetch (org.hibernate.sql.results.graph.collection.internal.DelayedCollectionFetch)1