Search in sources :

Example 1 with FetchGraphLoadPlanBuildingStrategy

use of org.hibernate.loader.plan.build.internal.FetchGraphLoadPlanBuildingStrategy in project hibernate-orm by hibernate.

the class EntityGraphLoadPlanBuilderTest method buildLoadPlan.

private LoadPlan buildLoadPlan(EntityGraph entityGraph, Mode mode, Class clazz) {
    LoadQueryInfluencers loadQueryInfluencers = new LoadQueryInfluencers(sfi());
    if (Mode.FETCH == mode) {
        loadQueryInfluencers.setFetchGraph(entityGraph);
    } else {
        loadQueryInfluencers.setLoadGraph(entityGraph);
    }
    EntityPersister ep = (EntityPersister) sfi().getClassMetadata(clazz);
    AbstractLoadPlanBuildingAssociationVisitationStrategy strategy = Mode.FETCH == mode ? new FetchGraphLoadPlanBuildingStrategy(sfi(), loadQueryInfluencers, LockMode.NONE) : new LoadGraphLoadPlanBuildingStrategy(sfi(), loadQueryInfluencers, LockMode.NONE);
    return MetamodelDrivenLoadPlanBuilder.buildRootEntityLoadPlan(strategy, ep);
}
Also used : LoadQueryInfluencers(org.hibernate.engine.spi.LoadQueryInfluencers) EntityPersister(org.hibernate.persister.entity.EntityPersister) AbstractLoadPlanBuildingAssociationVisitationStrategy(org.hibernate.loader.plan.build.internal.AbstractLoadPlanBuildingAssociationVisitationStrategy) FetchGraphLoadPlanBuildingStrategy(org.hibernate.loader.plan.build.internal.FetchGraphLoadPlanBuildingStrategy) LoadGraphLoadPlanBuildingStrategy(org.hibernate.loader.plan.build.internal.LoadGraphLoadPlanBuildingStrategy)

Aggregations

LoadQueryInfluencers (org.hibernate.engine.spi.LoadQueryInfluencers)1 AbstractLoadPlanBuildingAssociationVisitationStrategy (org.hibernate.loader.plan.build.internal.AbstractLoadPlanBuildingAssociationVisitationStrategy)1 FetchGraphLoadPlanBuildingStrategy (org.hibernate.loader.plan.build.internal.FetchGraphLoadPlanBuildingStrategy)1 LoadGraphLoadPlanBuildingStrategy (org.hibernate.loader.plan.build.internal.LoadGraphLoadPlanBuildingStrategy)1 EntityPersister (org.hibernate.persister.entity.EntityPersister)1