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() ); } }
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() ); } }
@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 ); }
@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 ); }
@Override protected CollectionInitializer buildNonBatchingLoader( QueryableCollection persister, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { return CollectionLoader.forCollection( persister ).withInfluencers( influencers ).byKey(); }
/** * 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 ); }
@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() ); }
/** * 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 ); }
@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() ); }
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 ); } }
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() ); }
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() ); }
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 ); } }
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); }
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); }
protected abstract CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers) throws MappingException;
protected abstract CollectionInitializer createCollectionInitializer(Map enabledFilters) throws MappingException;
/** * 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; }
/** * 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 ); }
/** * 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 ); }
protected abstract CollectionInitializer createSubselectInitializer(SubselectFetch subselect, SessionImplementor session);