Search in sources :

Example 1 with BatchEntitySelectFetchInitializer

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

the class CircularFetchImpl method createAssembler.

@Override
public DomainResultAssembler createAssembler(FetchParentAccess parentAccess, AssemblerCreationState creationState) {
    final DomainResultAssembler resultAssembler = keyResult.createResultAssembler(parentAccess, creationState);
    final EntityInitializer initializer = (EntityInitializer) creationState.resolveInitializer(getNavigablePath(), referencedModelPart, () -> {
        if (timing == FetchTiming.IMMEDIATE) {
            if (selectByUniqueKey) {
                return new EntitySelectFetchByUniqueKeyInitializer(parentAccess, fetchable, getNavigablePath(), entityMappingType.getEntityPersister(), resultAssembler);
            }
            final EntityPersister entityPersister = entityMappingType.getEntityPersister();
            if (entityPersister.isBatchLoadable()) {
                return new BatchEntitySelectFetchInitializer(parentAccess, (ToOneAttributeMapping) referencedModelPart, getReferencedPath(), entityPersister, resultAssembler);
            } else {
                return new EntitySelectFetchInitializer(parentAccess, (ToOneAttributeMapping) referencedModelPart, getReferencedPath(), entityPersister, resultAssembler);
            }
        } else {
            return new EntityDelayedFetchInitializer(parentAccess, getReferencedPath(), fetchable, selectByUniqueKey, resultAssembler);
        }
    });
    return new BiDirectionalFetchAssembler(initializer, fetchable.getJavaType());
}
Also used : EntityPersister(org.hibernate.persister.entity.EntityPersister) DomainResultAssembler(org.hibernate.sql.results.graph.DomainResultAssembler) ToOneAttributeMapping(org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping) EntityDelayedFetchInitializer(org.hibernate.sql.results.graph.entity.internal.EntityDelayedFetchInitializer) BatchEntitySelectFetchInitializer(org.hibernate.sql.results.graph.entity.internal.BatchEntitySelectFetchInitializer) EntitySelectFetchInitializer(org.hibernate.sql.results.graph.entity.internal.EntitySelectFetchInitializer) EntityInitializer(org.hibernate.sql.results.graph.entity.EntityInitializer) EntitySelectFetchByUniqueKeyInitializer(org.hibernate.sql.results.graph.entity.internal.EntitySelectFetchByUniqueKeyInitializer) BatchEntitySelectFetchInitializer(org.hibernate.sql.results.graph.entity.internal.BatchEntitySelectFetchInitializer)

Aggregations

ToOneAttributeMapping (org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping)1 EntityPersister (org.hibernate.persister.entity.EntityPersister)1 DomainResultAssembler (org.hibernate.sql.results.graph.DomainResultAssembler)1 EntityInitializer (org.hibernate.sql.results.graph.entity.EntityInitializer)1 BatchEntitySelectFetchInitializer (org.hibernate.sql.results.graph.entity.internal.BatchEntitySelectFetchInitializer)1 EntityDelayedFetchInitializer (org.hibernate.sql.results.graph.entity.internal.EntityDelayedFetchInitializer)1 EntitySelectFetchByUniqueKeyInitializer (org.hibernate.sql.results.graph.entity.internal.EntitySelectFetchByUniqueKeyInitializer)1 EntitySelectFetchInitializer (org.hibernate.sql.results.graph.entity.internal.EntitySelectFetchInitializer)1