public static boolean isJoinFetched(FetchStrategy fetchStrategy) { return fetchStrategy.getTiming() == FetchTiming.IMMEDIATE && fetchStrategy.getStyle() == FetchStyle.JOIN; } }
public boolean shouldIncludeJoin(FetchStrategy fetchStrategy) { return fetchStrategy.getTiming() == FetchTiming.IMMEDIATE && fetchStrategy.getStyle() == FetchStyle.JOIN; } }
public void processingFetch(Fetch fetch) { if ( ! hasSubselectFetch ) { if ( fetch.getFetchStrategy().getStyle() == FetchStyle.SUBSELECT && fetch.getFetchStrategy().getTiming() != FetchTiming.IMMEDIATE ) { hasSubselectFetch = true; } } if ( isJoinFetchedBag( fetch ) ) { if ( joinedBagAttributeFetches == null ) { joinedBagAttributeFetches = new HashSet<>(); } joinedBagAttributeFetches.add( (CollectionAttributeFetch) fetch ); } }
@Override protected FetchStrategy determineFetchStrategy(AssociationAttributeDefinition attributeDefinition) { FetchStrategy fetchStrategy = attributeDefinition.determineFetchPlan( loadQueryInfluencers, currentPropertyPath ); if ( fetchStrategy.getTiming() == FetchTiming.IMMEDIATE && fetchStrategy.getStyle() == FetchStyle.JOIN ) { // see if we need to alter the join fetch to another form for any reason fetchStrategy = adjustJoinFetchIfNeeded( attributeDefinition, fetchStrategy ); } return fetchStrategy; }
@Override protected FetchStrategy resolveImplicitFetchStrategyFromEntityGraph( final AssociationAttributeDefinition attributeDefinition) { FetchStrategy fetchStrategy = attributeDefinition.determineFetchPlan( loadQueryInfluencers, currentPropertyPath ); if ( fetchStrategy.getTiming() == FetchTiming.IMMEDIATE && fetchStrategy.getStyle() == FetchStyle.JOIN ) { // see if we need to alter the join fetch to another form for any reason fetchStrategy = adjustJoinFetchIfNeeded( attributeDefinition, fetchStrategy ); } return fetchStrategy; }
protected FetchStrategy adjustJoinFetchIfNeeded( AssociationAttributeDefinition attributeDefinition, FetchStrategy fetchStrategy) { if ( lockMode.greaterThan( LockMode.READ ) ) { return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } final Integer maxFetchDepth = sessionFactory().getSettings().getMaximumFetchDepth(); if ( maxFetchDepth != null && currentDepth() > maxFetchDepth ) { return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } if ( attributeDefinition.getType().isCollectionType() && isTooManyCollections() ) { // todo : have this revert to batch or subselect fetching once "sql gen redesign" is in place return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } return fetchStrategy; }
/** * If required by this strategy, returns a different {@link FetchStrategy} from what is specified * for the given association attribute. * * @param attributeDefinition The association attribute definition. * @param fetchStrategy The fetch strategy for <code>attributeDefinition</code>. * @return the {@link FetchStrategy}, possibly adjusted by this strategy. */ protected FetchStrategy adjustJoinFetchIfNeeded( AssociationAttributeDefinition attributeDefinition, FetchStrategy fetchStrategy) { if ( lockMode.greaterThan( LockMode.READ ) ) { return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } final Integer maxFetchDepth = sessionFactory().getSessionFactoryOptions().getMaximumFetchDepth(); if ( maxFetchDepth != null && currentDepth() > maxFetchDepth ) { return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } if ( attributeDefinition.getType().isCollectionType() && isTooManyCollections() ) { // todo : have this revert to batch or subselect fetching once "sql gen redesign" is in place return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT ); } return fetchStrategy; }
FetchTiming fetchTiming = fetchable.getMappedFetchStrategy().getTiming(); boolean joined = fetchable.getMappedFetchStrategy().getStyle() == FetchStyle.JOIN;
FetchTiming fetchTiming = fetchable.getMappedFetchStrategy().getTiming();