Java 类org.hibernate.loader.collection.CollectionInitializer 实例源码

项目:lams    文件:AbstractCollectionPersister.java   
protected CollectionInitializer getAppropriateInitializer(Serializable key, SessionImplementor session) {
    if ( queryLoaderName != null ) {
        // if there is a user-specified loader, return that
        // TODO: filters!?
        return initializer;
    }
    CollectionInitializer subselectInitializer = getSubselectInitializer( key, session );
    if ( subselectInitializer != null ) {
        return subselectInitializer;
    }
    else if ( session.getEnabledFilters().isEmpty() ) {
        return initializer;
    }
    else {
        return createCollectionInitializer( session.getLoadQueryInfluencers() );
    }
}
项目:cacheonix-core    文件:AbstractCollectionPersister.java   
protected CollectionInitializer getAppropriateInitializer(Serializable key, SessionImplementor session) {
    if ( queryLoaderName != null ) {
        //if there is a user-specified loader, return that
        //TODO: filters!?
        return initializer;
    }
    CollectionInitializer subselectInitializer = getSubselectInitializer( key, session );
    if ( subselectInitializer != null ) {
        return subselectInitializer;
    }
    else if ( session.getEnabledFilters().isEmpty() ) {
        return initializer;
    }
    else {
        return createCollectionInitializer( session.getEnabledFilters() );
    }
}
项目:lams    文件:LegacyBatchingCollectionInitializerBuilder.java   
@Override
public CollectionInitializer createRealBatchingCollectionInitializer(
        QueryableCollection persister,
        int maxBatchSize,
        SessionFactoryImplementor factory,
        LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
    int[] batchSizes = ArrayHelper.getBatchSizes( maxBatchSize );
    Loader[] loaders = new Loader[ batchSizes.length ];
    for ( int i = 0; i < batchSizes.length; i++ ) {
        loaders[i] = new BasicCollectionLoader( persister, batchSizes[i], factory, loadQueryInfluencers );
    }
    return new LegacyBatchingCollectionInitializer( persister, batchSizes, loaders );
}
项目:lams    文件:LegacyBatchingCollectionInitializerBuilder.java   
@Override
public CollectionInitializer createRealBatchingOneToManyInitializer(
        QueryableCollection persister,
        int maxBatchSize,
        SessionFactoryImplementor factory,
        LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
    final int[] batchSizes = ArrayHelper.getBatchSizes( maxBatchSize );
    final Loader[] loaders = new Loader[ batchSizes.length ];
    for ( int i = 0; i < batchSizes.length; i++ ) {
        loaders[i] = new OneToManyLoader( persister, batchSizes[i], factory, loadQueryInfluencers );
    }
    return new LegacyBatchingCollectionInitializer( persister, batchSizes, loaders );
}
项目:lams    文件:AbstractBatchingCollectionInitializerBuilder.java   
@Override
protected CollectionInitializer buildNonBatchingLoader(
        QueryableCollection persister,
        SessionFactoryImplementor factory,
        LoadQueryInfluencers influencers) {
    return CollectionLoader.forCollection( persister ).withInfluencers( influencers ).byKey();
}
项目:lams    文件:BasicCollectionPersister.java   
/**
 * Create the <tt>CollectionLoader</tt>
 *
 * @see org.hibernate.loader.collection.BasicCollectionLoader
 */
@Override
   protected CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers)
        throws MappingException {
    return BatchingCollectionInitializerBuilder.getBuilder( getFactory() )
            .createBatchingCollectionInitializer( this, batchSize, getFactory(), loadQueryInfluencers );
}
项目:lams    文件:BasicCollectionPersister.java   
@Override
   protected CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SessionImplementor session) {
    return new SubselectCollectionLoader( 
            this,
            subselect.toSubselectString( getCollectionType().getLHSPropertyName() ),
            subselect.getResult(),
            subselect.getQueryParameters(),
            subselect.getNamedParameterLocMap(),
            session.getFactory(),
            session.getLoadQueryInfluencers() 
    );
}
项目:lams    文件:OneToManyPersister.java   
/**
 * Create the <tt>OneToManyLoader</tt>
 *
 * @see org.hibernate.loader.collection.OneToManyLoader
 */
@Override
   protected CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers)
        throws MappingException {
    return BatchingCollectionInitializerBuilder.getBuilder( getFactory() )
            .createBatchingOneToManyInitializer( this, batchSize, getFactory(), loadQueryInfluencers );
}
项目:lams    文件:OneToManyPersister.java   
@Override
   protected CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SessionImplementor session) {
    return new SubselectOneToManyLoader( 
            this,
            subselect.toSubselectString( getCollectionType().getLHSPropertyName() ),
            subselect.getResult(),
            subselect.getQueryParameters(),
            subselect.getNamedParameterLocMap(),
            session.getFactory(),
            session.getLoadQueryInfluencers()
        );
}
项目:lams    文件:AbstractCollectionPersister.java   
private CollectionInitializer getSubselectInitializer(Serializable key, SessionImplementor session) {

        if ( !isSubselectLoadable() ) {
            return null;
        }

        final PersistenceContext persistenceContext = session.getPersistenceContext();

        SubselectFetch subselect = persistenceContext.getBatchFetchQueue()
                .getSubselect( session.generateEntityKey( key, getOwnerEntityPersister() ) );

        if ( subselect == null ) {
            return null;
        }
        else {

            // Take care of any entities that might have
            // been evicted!
            Iterator iter = subselect.getResult().iterator();
            while ( iter.hasNext() ) {
                if ( !persistenceContext.containsEntity( (EntityKey) iter.next() ) ) {
                    iter.remove();
                }
            }

            // Run a subquery loader
            return createSubselectInitializer( subselect, session );
        }
    }
项目:cacheonix-core    文件:BasicCollectionPersister.java   
protected CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SessionImplementor session) {
    return new SubselectCollectionLoader( 
            this,
            subselect.toSubselectString( getCollectionType().getLHSPropertyName() ),
            subselect.getResult(),
            subselect.getQueryParameters(),
            subselect.getNamedParameterLocMap(),
            session.getFactory(),
            session.getEnabledFilters() 
        );
}
项目:cacheonix-core    文件:OneToManyPersister.java   
protected CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SessionImplementor session) {
    return new SubselectOneToManyLoader( 
            this,
            subselect.toSubselectString( getCollectionType().getLHSPropertyName() ),
            subselect.getResult(),
            subselect.getQueryParameters(),
            subselect.getNamedParameterLocMap(),
            session.getFactory(),
            session.getEnabledFilters() 
        );
}
项目:cacheonix-core    文件:AbstractCollectionPersister.java   
private CollectionInitializer getSubselectInitializer(Serializable key, SessionImplementor session) {

        if ( !isSubselectLoadable() ) {
            return null;
        }

        final PersistenceContext persistenceContext = session.getPersistenceContext();

        SubselectFetch subselect = persistenceContext.getBatchFetchQueue()
            .getSubselect( new EntityKey( key, getOwnerEntityPersister(), session.getEntityMode() ) );

        if (subselect == null) {
            return null;
        }
        else {

            // Take care of any entities that might have
            // been evicted!    
            Iterator iter = subselect.getResult().iterator();
            while ( iter.hasNext() ) {
                if ( !persistenceContext.containsEntity( (EntityKey) iter.next() ) ) {
                    iter.remove();
                }
            }   

            // Run a subquery loader
            return createSubselectInitializer( subselect, session );
        }
    }
项目:webdsl    文件:BasicCollectionPersister.java   
protected CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
    if(utils.QueryOptimization.optimizationMode == 3 || utils.QueryOptimization.optimizationMode == 4 || utils.QueryOptimization.optimizationMode == 6) {
        batchInitializer = BatchingCollectionInitializer.createBatchingCollectionInitializer( this, batchSize, getFactory(), loadQueryInfluencers );
        return batchInitializer;
    }
    return super.createCollectionInitializer(loadQueryInfluencers);
}
项目:webdsl    文件:OneToManyPersister.java   
protected CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
    if(utils.QueryOptimization.optimizationMode == 3 || utils.QueryOptimization.optimizationMode == 4 || utils.QueryOptimization.optimizationMode == 6) {
        batchInitializer = BatchingCollectionInitializer.createBatchingOneToManyInitializer( this, batchSize, getFactory(), loadQueryInfluencers );
        return batchInitializer;
    }
    return super.createCollectionInitializer(loadQueryInfluencers);
}
项目:lams    文件:AbstractCollectionPersister.java   
protected abstract CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers)
throws MappingException;
项目:cacheonix-core    文件:AbstractCollectionPersister.java   
protected abstract CollectionInitializer createCollectionInitializer(Map enabledFilters)
throws MappingException;
项目:lams    文件:AbstractCollectionPersister.java   
/**
 * Intended for internal use only. In fact really only currently used from
 * test suite for assertion purposes.
 *
 * @return The default collection initializer for this persister/collection.
 */
public CollectionInitializer getInitializer() {
    return initializer;
}
项目:cacheonix-core    文件:BasicCollectionPersister.java   
/**
 * Create the <tt>CollectionLoader</tt>
 *
 * @see org.hibernate.loader.collection.BasicCollectionLoader
 */
protected CollectionInitializer createCollectionInitializer(java.util.Map enabledFilters)
        throws MappingException {
    return BatchingCollectionInitializer.createBatchingCollectionInitializer( this, batchSize, getFactory(), enabledFilters );
}
项目:cacheonix-core    文件:OneToManyPersister.java   
/**
 * Create the <tt>OneToManyLoader</tt>
 *
 * @see org.hibernate.loader.collection.OneToManyLoader
 */
protected CollectionInitializer createCollectionInitializer(java.util.Map enabledFilters) throws MappingException {
    return BatchingCollectionInitializer.createBatchingOneToManyInitializer( this, batchSize, getFactory(), enabledFilters );
}
项目:lams    文件:AbstractCollectionPersister.java   
protected abstract CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SessionImplementor session);
项目:cacheonix-core    文件:AbstractCollectionPersister.java   
protected abstract CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SessionImplementor session);