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; }
@Override public FetchStrategy determineFetchPlan(LoadQueryInfluencers loadQueryInfluencers, PropertyPath propertyPath) { final EntityPersister owningPersister = getSource().locateOwningPersister(); FetchStyle style = FetchStrategyHelper.determineFetchStyleByProfile( loadQueryInfluencers, owningPersister, propertyPath, attributeNumber() ); if ( style == null ) { style = determineFetchStyleByMetadata( getFetchMode(), getType() ); } return new FetchStrategy( determineFetchTiming( style ), style ); }
@Override public FetchStrategy determineFetchPlan(LoadQueryInfluencers loadQueryInfluencers, PropertyPath propertyPath) { final EntityPersister owningPersister = getSource().getEntityPersister(); FetchStyle style = FetchStrategyHelper.determineFetchStyleByProfile( loadQueryInfluencers, owningPersister, propertyPath, attributeNumber() ); if ( style == null ) { style = FetchStrategyHelper.determineFetchStyleByMetadata( ( (OuterJoinLoadable) getSource().getEntityPersister() ).getFetchMode( attributeNumber() ), getType(), sessionFactory() ); } return new FetchStrategy( FetchStrategyHelper.determineFetchTiming( style, getType(), sessionFactory() ), style ); }
public static FetchStrategy determineFetchStrategy(Collection bootCollectionDescriptor) { return new FetchStrategy( determineTiming( bootCollectionDescriptor ), determineStyle( bootCollectionDescriptor ) ); }
public static FetchStrategy determineFetchStrategy( PersistentAttributeMapping bootModelAttribute, ManagedTypeDescriptor runtimeModelContainer, EntityTypeDescriptor entityDescriptor) { FetchStyle style = determineStyle( bootModelAttribute, entityDescriptor ); return new FetchStrategy( determineTiming( style, bootModelAttribute, runtimeModelContainer, entityDescriptor ), style ); }
@SuppressWarnings("unchecked") public SingularPersistentAttributeBasic( ManagedTypeDescriptor<O> runtimeContainer, PersistentAttributeMapping bootAttribute, PropertyAccess propertyAccess, Disposition disposition, RuntimeModelCreationContext context) { super( runtimeContainer, bootAttribute, propertyAccess, disposition ); final BasicValueMapping bootMapping = (BasicValueMapping) bootAttribute.getValueMapping(); this.boundColumn = context.getDatabaseObjectResolver().resolveColumn( bootMapping.getMappedColumn() ); this.valueMapper = bootMapping.getResolution().getValueMapper(); if ( valueMapper.getValueConverter() != null ) { log.debugf( "BasicValueConverter [%s] being applied for basic attribute : %s", valueMapper.getValueConverter(), getNavigableRole() ); } this.fetchStrategy = bootAttribute.isLazy() ? new FetchStrategy( FetchTiming.DELAYED, FetchStyle.SELECT ) : FetchStrategy.IMMEDIATE_JOIN; instantiationComplete( bootAttribute, context ); }