protected final boolean isJoinFetchEnabledByProfile(OuterJoinLoadable persister, PropertyPath path, int propertyNumber) { if ( !getLoadQueryInfluencers().hasEnabledFetchProfiles() ) { // perf optimization return false; } // ugh, this stuff has to be made easier... final String fullPath = path.getFullPath(); String rootPropertyName = persister.getSubclassPropertyName( propertyNumber ); int pos = fullPath.lastIndexOf( rootPropertyName ); String relativePropertyPath = pos >= 0 ? fullPath.substring( pos ) : rootPropertyName; String fetchRole = persister.getEntityName() + "." + relativePropertyPath; for ( String profileName : getLoadQueryInfluencers().getEnabledFetchProfileNames() ) { final FetchProfile profile = getFactory().getFetchProfile( profileName ); final Fetch fetch = profile.getFetchByRole( fetchRole ); if ( fetch != null && Fetch.Style.JOIN == fetch.getStyle() ) { return true; } } return false; }
/** * Determine the fetch-style (if one) explicitly set for this association via fetch profiles. * <p/> * Note that currently fetch profiles only allow specifying join fetching, so this method currently * returns either (a) FetchStyle.JOIN or (b) null * * @param loadQueryInfluencers * @param persister * @param path * @param propertyNumber * * @return */ public static FetchStyle determineFetchStyleByProfile( LoadQueryInfluencers loadQueryInfluencers, EntityPersister persister, PropertyPath path, int propertyNumber) { if ( !loadQueryInfluencers.hasEnabledFetchProfiles() ) { // perf optimization return null; } // ugh, this stuff has to be made easier... final String fullPath = path.getFullPath(); final String rootPropertyName = ( (OuterJoinLoadable) persister ).getSubclassPropertyName( propertyNumber ); int pos = fullPath.lastIndexOf( rootPropertyName ); final String relativePropertyPath = pos >= 0 ? fullPath.substring( pos ) : rootPropertyName; final String fetchRole = persister.getEntityName() + "." + relativePropertyPath; for ( String profileName : loadQueryInfluencers.getEnabledFetchProfileNames() ) { final FetchProfile profile = loadQueryInfluencers.getSessionFactory().getFetchProfile( profileName ); final Fetch fetch = profile.getFetchByRole( fetchRole ); if ( fetch != null && Fetch.Style.JOIN == fetch.getStyle() ) { return FetchStyle.JOIN; } } return null; }
public FetchProfile getFetchProfile(String name) { return sessionFactoryImplementor.getFetchProfile(name); }
public FetchProfile getFetchProfile(String name) { return fetchProfiles.get( name ); }
public FetchProfile getFetchProfile(String name) { return fetchProfiles.get(name); }
/** * Retrieve fetch profile by name. * * @param name The name of the profile to retrieve. * @return The profile definition */ public FetchProfile getFetchProfile(String name);