Java 类org.hibernate.engine.profile.FetchProfile 实例源码

项目:lams    文件:AbstractEntityJoinWalker.java   
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;
}
项目:lams    文件:FetchStrategyHelper.java   
/**
 * 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;
}
项目:lemon    文件:SessionFactoryWrapper.java   
public FetchProfile getFetchProfile(String name) {
    return sessionFactoryImplementor.getFetchProfile(name);
}
项目:lams    文件:SessionFactoryImpl.java   
public FetchProfile getFetchProfile(String name) {
    return fetchProfiles.get( name );
}
项目:hibernate-dynamic-dialects    文件:SessionFactoryImpl.java   
public FetchProfile getFetchProfile(String name) {
    return fetchProfiles.get(name);
}
项目:lams    文件:SessionFactoryImplementor.java   
/**
 * Retrieve fetch profile by name.
 *
 * @param name The name of the profile to retrieve.
 * @return The profile definition
 */
public FetchProfile getFetchProfile(String name);