org.hibernate.engine.spi.LoadQueryInfluencers Java Examples
The following examples show how to use
org.hibernate.engine.spi.LoadQueryInfluencers.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SubselectCollectionLoader.java From lams with GNU General Public License v2.0 | 6 votes |
public SubselectCollectionLoader( QueryableCollection persister, String subquery, Collection entityKeys, QueryParameters queryParameters, Map<String, int[]> namedParameterLocMap, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( persister, 1, subquery, factory, loadQueryInfluencers ); keys = new Serializable[ entityKeys.size() ]; Iterator iter = entityKeys.iterator(); int i=0; while ( iter.hasNext() ) { keys[i++] = ( (EntityKey) iter.next() ).getIdentifier(); } this.namedParameters = queryParameters.getNamedParameters(); this.types = queryParameters.getFilteredPositionalParameterTypes(); this.values = queryParameters.getFilteredPositionalParameterValues(); this.namedParameterLocMap = namedParameterLocMap; }
Example #2
Source File: EntityLoader.java From lams with GNU General Public License v2.0 | 6 votes |
public EntityLoader( OuterJoinLoadable persister, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { this( persister, persister.getIdentifierColumnNames(), persister.getIdentifierType(), batchSize, lockMode, factory, loadQueryInfluencers ); }
Example #3
Source File: ReactiveSubselectOneToManyLoader.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 6 votes |
public ReactiveSubselectOneToManyLoader( QueryableCollection persister, String subquery, Collection entityKeys, QueryParameters queryParameters, Map<String, int[]> namedParameterLocMap, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( persister, 1, subquery, factory, loadQueryInfluencers ); keys = new Serializable[ entityKeys.size() ]; Iterator iter = entityKeys.iterator(); int i=0; while ( iter.hasNext() ) { keys[i++] = ( (EntityKey) iter.next() ).getIdentifier(); } this.namedParameters = queryParameters.getNamedParameters(); this.types = queryParameters.getFilteredPositionalParameterTypes(); this.values = queryParameters.getFilteredPositionalParameterValues(); this.namedParameterLocMap = namedParameterLocMap; }
Example #4
Source File: EntityJoinWalker.java From lams with GNU General Public License v2.0 | 6 votes |
public EntityJoinWalker( OuterJoinLoadable persister, String[] uniqueKey, int batchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( persister, factory, loadQueryInfluencers ); LockOptions.copy(lockOptions, this.lockOptions); StringBuilder whereCondition = whereString( getAlias(), uniqueKey, batchSize ) //include the discriminator and class-level where, but not filters .append( persister.filterFragment( getAlias(), Collections.EMPTY_MAP ) ); AssociationInitCallbackImpl callback = new AssociationInitCallbackImpl( factory ); initAll( whereCondition.toString(), "", lockOptions, callback ); this.compositeKeyManyToOneTargetIndices = callback.resolve(); }
Example #5
Source File: EntityJoinWalker.java From lams with GNU General Public License v2.0 | 6 votes |
public EntityJoinWalker( OuterJoinLoadable persister, String[] uniqueKey, int batchSize, LockMode lockMode, final SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( persister, factory, loadQueryInfluencers ); this.lockOptions.setLockMode(lockMode); StringBuilder whereCondition = whereString( getAlias(), uniqueKey, batchSize ) //include the discriminator and class-level where, but not filters .append( persister.filterFragment( getAlias(), Collections.EMPTY_MAP ) ); AssociationInitCallbackImpl callback = new AssociationInitCallbackImpl( factory ); initAll( whereCondition.toString(), "", lockOptions, callback ); this.compositeKeyManyToOneTargetIndices = callback.resolve(); }
Example #6
Source File: ReactiveCascadeEntityLoader.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 6 votes |
public ReactiveCascadeEntityLoader( OuterJoinLoadable persister, CascadingAction action, SessionFactoryImplementor factory) throws MappingException { super( persister, persister.getIdentifierType(), factory, LoadQueryInfluencers.NONE ); initFromWalker( new CascadeEntityJoinWalker( persister, action, factory ) ); postInstantiate(); if ( LOG.isDebugEnabled() ) { LOG.debugf( "Static select for action %s on entity %s: %s", action, entityName, getSQLString() ); } }
Example #7
Source File: BasicCollectionJoinWalker.java From lams with GNU General Public License v2.0 | 6 votes |
public BasicCollectionJoinWalker( QueryableCollection collectionPersister, int batchSize, String subquery, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( factory, loadQueryInfluencers ); this.collectionPersister = collectionPersister; String alias = generateRootAlias( collectionPersister.getRole() ); walkCollectionTree(collectionPersister, alias); List allAssociations = new ArrayList(); allAssociations.addAll(associations); allAssociations.add( OuterJoinableAssociation.createRoot( collectionPersister.getCollectionType(), alias, getFactory() ) ); initPersisters(allAssociations, LockMode.NONE); initStatementString(alias, batchSize, subquery); }
Example #8
Source File: EntityBasedAssociationAttribute.java From lams with GNU General Public License v2.0 | 6 votes |
@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 ); }
Example #9
Source File: SessionImpl.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Used by JDK serialization... * * @param ois The input stream from which we are being read... * * @throws IOException Indicates a general IO stream exception * @throws ClassNotFoundException Indicates a class resolution issue */ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException, SQLException { if ( TRACE_ENABLED ) { log.tracef( "Deserializing Session [%s]", getSessionIdentifier() ); } ois.defaultReadObject(); persistenceContext = StatefulPersistenceContext.deserialize( ois, this ); actionQueue = ActionQueue.deserialize( ois, this ); loadQueryInfluencers = (LoadQueryInfluencers) ois.readObject(); // LoadQueryInfluencers.getEnabledFilters() tries to validate each enabled // filter, which will fail when called before FilterImpl.afterDeserialize( factory ); // Instead lookup the filter by name and then call FilterImpl.afterDeserialize( factory ). for ( String filterName : loadQueryInfluencers.getEnabledFilterNames() ) { ( (FilterImpl) loadQueryInfluencers.getEnabledFilter( filterName ) ).afterDeserialize( getFactory() ); } initializeFromSessionOwner( null ); this.disallowOutOfTransactionUpdateOperations = !getFactory().getSessionFactoryOptions().isAllowOutOfTransactionUpdateOperations(); this.discardOnClose = getFactory().getSessionFactoryOptions().isReleaseResourcesOnCloseEnabled(); }
Example #10
Source File: DynamicBatchingCollectionInitializerBuilder.java From lams with GNU General Public License v2.0 | 6 votes |
public DynamicBatchingCollectionLoader( QueryableCollection collectionPersister, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { super( collectionPersister, factory, influencers ); JoinWalker walker = buildJoinWalker( collectionPersister, factory, influencers ); initFromWalker( walker ); this.sqlTemplate = walker.getSQLString(); this.alias = StringHelper.generateAlias( collectionPersister.getRole(), 0 ); postInstantiate(); if ( LOG.isDebugEnabled() ) { LOG.debugf( "SQL-template for dynamic collection [%s] batch-fetching : %s", collectionPersister.getRole(), sqlTemplate ); } }
Example #11
Source File: AbstractEntityPersister.java From lams with GNU General Public License v2.0 | 6 votes |
private EntityLoader createUniqueKeyLoader( Type uniqueKeyType, String[] columns, LoadQueryInfluencers loadQueryInfluencers) { if ( uniqueKeyType.isEntityType() ) { String className = ( (EntityType) uniqueKeyType ).getAssociatedEntityName(); uniqueKeyType = getFactory().getMetamodel().entityPersister( className ).getIdentifierType(); } return new EntityLoader( this, columns, uniqueKeyType, 1, LockMode.NONE, getFactory(), loadQueryInfluencers ); }
Example #12
Source File: OneToManyLoader.java From lams with GNU General Public License v2.0 | 6 votes |
public OneToManyLoader( QueryableCollection oneToManyPersister, int batchSize, String subquery, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( oneToManyPersister, factory, loadQueryInfluencers ); JoinWalker walker = new OneToManyJoinWalker( oneToManyPersister, batchSize, subquery, factory, loadQueryInfluencers ); initFromWalker( walker ); postInstantiate(); if ( LOG.isDebugEnabled() ) { LOG.debugf( "Static select for one-to-many %s: %s", oneToManyPersister.getRole(), getSQLString() ); } }
Example #13
Source File: DynamicBatchingCollectionInitializerBuilder.java From lams with GNU General Public License v2.0 | 6 votes |
public DynamicBatchingCollectionInitializer( QueryableCollection collectionPersister, int maxBatchSize, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { super( collectionPersister ); this.maxBatchSize = maxBatchSize; if ( collectionPersister.isOneToMany() ) { this.singleKeyLoader = new OneToManyLoader( collectionPersister, 1, factory, influencers ); } else { this.singleKeyLoader = new BasicCollectionLoader( collectionPersister, 1, factory, influencers ); } this.batchLoader = new DynamicBatchingCollectionLoader( collectionPersister, factory, influencers ); }
Example #14
Source File: ReactiveOneToManyLoader.java From hibernate-reactive with GNU Lesser General Public License v2.1 | 6 votes |
public ReactiveOneToManyLoader( QueryableCollection oneToManyPersister, int batchSize, String subquery, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super(oneToManyPersister, factory, loadQueryInfluencers); initFromWalker( new OneToManyJoinWalker( oneToManyPersister, batchSize, subquery, factory, loadQueryInfluencers ) ); postInstantiate(); if (LOG.isDebugEnabled()) { LOG.debugf("Static select for one-to-many %s: %s", oneToManyPersister.getRole(), getSQLString()); } }
Example #15
Source File: BasicCollectionLoader.java From lams with GNU General Public License v2.0 | 6 votes |
protected BasicCollectionLoader( QueryableCollection collectionPersister, int batchSize, String subquery, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( collectionPersister, factory, loadQueryInfluencers ); JoinWalker walker = new BasicCollectionJoinWalker( collectionPersister, batchSize, subquery, factory, loadQueryInfluencers ); initFromWalker( walker ); postInstantiate(); if ( LOG.isDebugEnabled() ) { LOG.debugf( "Static select for collection %s: %s", collectionPersister.getRole(), getSQLString() ); } }
Example #16
Source File: LegacyBatchingEntityLoaderBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
@Override protected UniqueEntityLoader buildBatchingLoader( OuterJoinLoadable persister, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { return new LegacyBatchingEntityLoader( persister, batchSize, lockMode, factory, influencers ); }
Example #17
Source File: LegacyBatchingEntityLoaderBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
public LegacyBatchingEntityLoader( OuterJoinLoadable persister, int maxBatchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { super( persister ); this.batchSizes = ArrayHelper.getBatchSizes( maxBatchSize ); this.loaders = new Loader[ batchSizes.length ]; for ( int i = 0; i < batchSizes.length; i++ ) { this.loaders[i] = new EntityLoader( persister, batchSizes[i], lockOptions, factory, loadQueryInfluencers); } }
Example #18
Source File: PaddedBatchingEntityLoaderBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
public PaddedBatchingEntityLoader( OuterJoinLoadable persister, int maxBatchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { super( persister ); this.batchSizes = ArrayHelper.getBatchSizes( maxBatchSize ); this.loaders = new Loader[ batchSizes.length ]; for ( int i = 0; i < batchSizes.length; i++ ) { this.loaders[i] = new EntityLoader( persister, batchSizes[i], lockMode, factory, loadQueryInfluencers); } validate( maxBatchSize ); }
Example #19
Source File: CascadeEntityJoinWalker.java From lams with GNU General Public License v2.0 | 5 votes |
public CascadeEntityJoinWalker( OuterJoinLoadable persister, CascadingAction action, SessionFactoryImplementor factory) throws MappingException { super( persister, factory, LoadQueryInfluencers.NONE ); this.cascadeAction = action; StringBuilder whereCondition = whereString( getAlias(), persister.getIdentifierColumnNames(), 1 ) //include the discriminator and class-level where, but not filters .append( persister.filterFragment( getAlias(), Collections.EMPTY_MAP ) ); initAll( whereCondition.toString(), "", LockOptions.READ ); }
Example #20
Source File: QueryBuildingParametersImpl.java From lams with GNU General Public License v2.0 | 5 votes |
public QueryBuildingParametersImpl( LoadQueryInfluencers loadQueryInfluencers, int batchSize, LockMode lockMode, LockOptions lockOptions) { this.loadQueryInfluencers = loadQueryInfluencers; this.batchSize = batchSize; this.lockMode = lockMode; this.lockOptions = lockOptions; }
Example #21
Source File: PaddedBatchingEntityLoaderBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
@Override protected UniqueEntityLoader buildBatchingLoader( OuterJoinLoadable persister, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { return new PaddedBatchingEntityLoader( persister, batchSize, lockMode, factory, influencers ); }
Example #22
Source File: LegacyBatchingCollectionInitializerBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
@Override protected 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 ); }
Example #23
Source File: OneToManyJoinWalker.java From lams with GNU General Public License v2.0 | 5 votes |
public OneToManyJoinWalker( QueryableCollection oneToManyPersister, int batchSize, String subquery, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { super( factory, loadQueryInfluencers ); this.oneToManyPersister = oneToManyPersister; final OuterJoinLoadable elementPersister = (OuterJoinLoadable) oneToManyPersister.getElementPersister(); final String alias = generateRootAlias( oneToManyPersister.getRole() ); walkEntityTree( elementPersister, alias ); List allAssociations = new ArrayList(); allAssociations.addAll( associations ); allAssociations.add( OuterJoinableAssociation.createRoot( oneToManyPersister.getCollectionType(), alias, getFactory() ) ); initPersisters( allAssociations, LockMode.NONE ); initStatementString( elementPersister, alias, batchSize, subquery ); }
Example #24
Source File: DynamicBatchingCollectionInitializerBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
@Override protected CollectionInitializer createRealBatchingCollectionInitializer( QueryableCollection persister, int maxBatchSize, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { return new DynamicBatchingCollectionInitializer( persister, maxBatchSize, factory, influencers ); }
Example #25
Source File: BatchingEntityLoaderBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
protected UniqueEntityLoader buildNonBatchingLoader( OuterJoinLoadable persister, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { return new EntityLoader( persister, lockOptions, factory, influencers ); }
Example #26
Source File: BatchingEntityLoaderBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Builds a batch-fetch capable loader based on the given persister, lock-options, etc. * * @param persister The entity persister * @param batchSize The maximum number of ids to batch-fetch at once * @param lockOptions The lock options * @param factory The SessionFactory * @param influencers Any influencers that should affect the built query * * @return The loader. */ public UniqueEntityLoader buildLoader( OuterJoinLoadable persister, int batchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers influencers) { if ( batchSize <= 1 ) { // no batching return buildNonBatchingLoader( persister, lockOptions, factory, influencers ); } return buildBatchingLoader( persister, batchSize, lockOptions, factory, influencers ); }
Example #27
Source File: CriteriaJoinWalker.java From lams with GNU General Public License v2.0 | 5 votes |
public CriteriaJoinWalker( final OuterJoinLoadable persister, final CriteriaQueryTranslator translator, final SessionFactoryImplementor factory, final CriteriaImpl criteria, final String rootEntityName, final LoadQueryInfluencers loadQueryInfluencers, final String alias) { super( persister, factory, loadQueryInfluencers, alias ); this.translator = translator; querySpaces = translator.getQuerySpaces(); if ( translator.hasProjection() ) { initProjection( translator.getSelect(), translator.getWhereCondition(), translator.getOrderBy(), translator.getGroupBy(), LockOptions.NONE ); resultTypes = translator.getProjectedTypes(); userAliases = translator.getProjectedAliases(); includeInResultRow = new boolean[resultTypes.length]; Arrays.fill( includeInResultRow, true ); } else { initAll( translator.getWhereCondition(), translator.getOrderBy(), LockOptions.NONE ); // root entity comes last userAliasList.add( criteria.getAlias() ); //root entity comes *last* resultTypeList.add( translator.getResultType( criteria ) ); includeInResultRowList.add( true ); userAliases = ArrayHelper.toStringArray( userAliasList ); resultTypes = ArrayHelper.toTypeArray( resultTypeList ); includeInResultRow = ArrayHelper.toBooleanArray( includeInResultRowList ); } }
Example #28
Source File: AbstractEntityLoader.java From lams with GNU General Public License v2.0 | 5 votes |
public AbstractEntityLoader( OuterJoinLoadable persister, Type uniqueKeyType, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { super( factory, loadQueryInfluencers ); this.uniqueKeyType = uniqueKeyType; this.entityName = persister.getEntityName(); this.persister = persister; }
Example #29
Source File: LegacyBatchingEntityLoaderBuilder.java From lams with GNU General Public License v2.0 | 5 votes |
public LegacyBatchingEntityLoader( OuterJoinLoadable persister, int maxBatchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) { this( persister, maxBatchSize, lockMode, null, factory, loadQueryInfluencers ); }
Example #30
Source File: BasicCollectionLoader.java From lams with GNU General Public License v2.0 | 5 votes |
public BasicCollectionLoader( QueryableCollection collectionPersister, int batchSize, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers) throws MappingException { this( collectionPersister, batchSize, null, factory, loadQueryInfluencers ); }