org.hibernate.persister.entity.OuterJoinLoadable Java Examples

The following examples show how to use org.hibernate.persister.entity.OuterJoinLoadable. 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: EntityJoinWalker.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
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 #2
Source File: BasicCollectionLoadQueryDetails.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void applyRootReturnSelectFragments(SelectStatementBuilder selectStatementBuilder) {
	selectStatementBuilder.appendSelectClauseFragment(
		getQueryableCollection().selectFragment(
				getCollectionReferenceAliases().getCollectionTableAlias(),
				getCollectionReferenceAliases().getCollectionColumnAliases().getSuffix()
		)
	);
	if ( getQueryableCollection().isManyToMany() ) {
		final OuterJoinLoadable elementPersister = (OuterJoinLoadable) getQueryableCollection().getElementPersister();
		selectStatementBuilder.appendSelectClauseFragment(
				elementPersister.selectFragment(
						getCollectionReferenceAliases().getElementTableAlias(),
						getCollectionReferenceAliases().getEntityElementAliases().getColumnAliases().getSuffix()
				)
		);
	}
	super.applyRootReturnSelectFragments( selectStatementBuilder );
}
 
Example #3
Source File: BatchingEntityLoader.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static UniqueEntityLoader createBatchingEntityLoader(
	final OuterJoinLoadable persister,
	final int maxBatchSize,
	final LockMode lockMode,
	final SessionFactoryImplementor factory,
	final Map enabledFilters)
throws MappingException {

	if ( maxBatchSize>1 ) {
		int[] batchSizesToCreate = ArrayHelper.getBatchSizes(maxBatchSize);
		Loader[] loadersToCreate = new Loader[ batchSizesToCreate.length ];
		for ( int i=0; i<batchSizesToCreate.length; i++ ) {
			loadersToCreate[i] = new EntityLoader(persister, batchSizesToCreate[i], lockMode, factory, enabledFilters);
		}
		return new BatchingEntityLoader(persister, batchSizesToCreate, loadersToCreate);
	}
	else {
		return new EntityLoader(persister, lockMode, factory, enabledFilters);
	}
}
 
Example #4
Source File: OneToManyPersister.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public String selectFragment(
	        Joinable rhs,
	        String rhsAlias,
	        String lhsAlias,
	        String entitySuffix,
	        String collectionSuffix,
	        boolean includeCollectionColumns) {
		StringBuffer buf = new StringBuffer();
		if ( includeCollectionColumns ) {
//			buf.append( selectFragment( lhsAlias, "" ) )//ignore suffix for collection columns!
			buf.append( selectFragment( lhsAlias, collectionSuffix ) )
					.append( ", " );
		}
		OuterJoinLoadable ojl = ( OuterJoinLoadable ) getElementPersister();
		return buf.append( ojl.selectFragment( lhsAlias, entitySuffix ) )//use suffix for the entity columns
				.toString();
	}
 
Example #5
Source File: JoinWalker.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Determine the appropriate type of join (if any) to use to fetch the
 * given association.
 *
 * @param persister The owner of the association.
 * @param path The path to the association
 * @param propertyNumber The property number representing the association.
 * @param associationType The association type.
 * @param metadataFetchMode The metadata-defined fetch mode.
 * @param metadataCascadeStyle The metadata-defined cascade style.
 * @param lhsTable The owner table
 * @param lhsColumns The owner join columns
 * @param nullable Is the association nullable.
 * @param currentDepth Current join depth
 *
 * @return type of join to use ({@link org.hibernate.sql.JoinType#INNER_JOIN},
 * {@link org.hibernate.sql.JoinType#LEFT_OUTER_JOIN}, or -1 to indicate no joining.
 *
 * @throws MappingException ??
 */
protected JoinType getJoinType(
		OuterJoinLoadable persister,
		final PropertyPath path,
		int propertyNumber,
		AssociationType associationType,
		FetchMode metadataFetchMode,
		CascadeStyle metadataCascadeStyle,
		String lhsTable,
		String[] lhsColumns,
		final boolean nullable,
		final int currentDepth) throws MappingException {
	return getJoinType(
			associationType,
			metadataFetchMode,
			path,
			lhsTable,
			lhsColumns,
			nullable,
			currentDepth,
			metadataCascadeStyle
	);
}
 
Example #6
Source File: ReactiveCascadeEntityLoader.java    From hibernate-reactive with GNU Lesser General Public License v2.1 6 votes vote down vote up
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: EntityLoader.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public EntityLoader(
		OuterJoinLoadable persister, 
		int batchSize, 
		LockMode lockMode,
		SessionFactoryImplementor factory, 
		Map enabledFilters) 
throws MappingException {
	this( 
			persister, 
			persister.getIdentifierColumnNames(), 
			persister.getIdentifierType(), 
			batchSize,
			lockMode,
			factory, 
			enabledFilters 
		);
}
 
Example #8
Source File: EntityBasedAssociationAttribute.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@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: EntityJoinWalker.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
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 #10
Source File: CascadeEntityLoader.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public CascadeEntityLoader(
		OuterJoinLoadable persister,
		CascadingAction action,
		SessionFactoryImplementor factory) 
throws MappingException {
	super(
			persister, 
			persister.getIdentifierType(), 
			factory, 
			CollectionHelper.EMPTY_MAP
		);

	JoinWalker walker = new CascadeEntityJoinWalker(
			persister, 
			action,
			factory
		);
	initFromWalker( walker );

	postInstantiate();
	
	log.debug( "Static select for action " + action + " on entity " + entityName + ": " + getSQLString() );

}
 
Example #11
Source File: EntityLoadQueryDetails.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Applies "table fragments" to the FROM-CLAUSE of the given SelectStatementBuilder for the given Loadable
 *
 * @param select The SELECT statement builder
 *
 * @see org.hibernate.persister.entity.OuterJoinLoadable#fromTableFragment(java.lang.String)
 * @see org.hibernate.persister.entity.Joinable#fromJoinFragment(java.lang.String, boolean, boolean)
 */
protected void applyRootReturnTableFragments(SelectStatementBuilder select) {
	final String fromTableFragment;
	final String rootAlias = entityReferenceAliases.getTableAlias();
	final OuterJoinLoadable outerJoinLoadable = (OuterJoinLoadable) getRootEntityReturn().getEntityPersister();
	final Dialect dialect = getSessionFactory().getJdbcServices().getJdbcEnvironment().getDialect();
	if ( getQueryBuildingParameters().getLockOptions() != null ) {
		fromTableFragment = dialect.appendLockHint(
				getQueryBuildingParameters().getLockOptions(),
				outerJoinLoadable.fromTableFragment( rootAlias )
		);
		select.setLockOptions( getQueryBuildingParameters().getLockOptions() );
	}
	else if ( getQueryBuildingParameters().getLockMode() != null ) {
		fromTableFragment = dialect.appendLockHint(
				getQueryBuildingParameters().getLockMode(),
				outerJoinLoadable.fromTableFragment( rootAlias )
		);
		select.setLockMode( getQueryBuildingParameters().getLockMode() );
	}
	else {
		fromTableFragment = outerJoinLoadable.fromTableFragment( rootAlias );
	}
	select.appendFromClauseFragment( fromTableFragment + outerJoinLoadable.fromJoinFragment( rootAlias, true, true ) );
}
 
Example #12
Source File: EntityLoader.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public EntityLoader(
		OuterJoinLoadable persister,
		int batchSize,
		LockOptions lockOptions,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
	this(
			persister,
			persister.getIdentifierColumnNames(),
			persister.getIdentifierType(),
			batchSize,
			lockOptions,
			factory,
			loadQueryInfluencers
		);
}
 
Example #13
Source File: ReactiveDynamicBatchingEntityLoaderBuilder.java    From hibernate-reactive with GNU Lesser General Public License v2.1 6 votes vote down vote up
private static QueryParameters buildMultiLoadQueryParameters(
		OuterJoinLoadable persister,
		Serializable[] ids,
		LockOptions lockOptions) {
	Type[] types = new Type[ids.length];
	Arrays.fill( types, persister.getIdentifierType() );

	QueryParameters qp = new QueryParameters();
	qp.setOptionalEntityName( persister.getEntityName() );
	qp.setPositionalParameterTypes( types );
	qp.setPositionalParameterValues( ids );
	qp.setLockOptions( lockOptions );
	qp.setOptionalObject( null );
	qp.setOptionalId( null );
	return qp;
}
 
Example #14
Source File: JoinHelper.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Get the columns of the associated table which are to 
 * be used in the join
 */
public static String[] getRHSColumnNames(AssociationType type, SessionFactoryImplementor factory) {
	String uniqueKeyPropertyName = type.getRHSUniqueKeyPropertyName();
	Joinable joinable = type.getAssociatedJoinable(factory);
	if (uniqueKeyPropertyName==null) {
		return joinable.getKeyColumnNames();
	}
	else {
		return ( (OuterJoinLoadable) joinable ).getPropertyColumnNames(uniqueKeyPropertyName);
	}
}
 
Example #15
Source File: AbstractBatchingEntityLoaderBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected UniqueEntityLoader buildNonBatchingLoader(
		OuterJoinLoadable persister,
		LockOptions lockOptions,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers influencers) {
	return EntityLoader.forEntity( persister ).withLockOptions( lockOptions ).withInfluencers( influencers ).byPrimaryKey();
}
 
Example #16
Source File: EntityLoader.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public EntityLoader(
		OuterJoinLoadable persister, 
		String[] uniqueKey, 
		Type uniqueKeyType, 
		int batchSize, 
		LockMode lockMode,
		SessionFactoryImplementor factory, 
		Map enabledFilters) 
throws MappingException {
	super(persister, uniqueKeyType, factory, enabledFilters);

	JoinWalker walker = new EntityJoinWalker(
			persister, 
			uniqueKey, 
			batchSize, 
			lockMode, 
			factory, 
			enabledFilters
		);
	initFromWalker( walker );

	postInstantiate();

	batchLoader = batchSize > 1;
	
	log.debug( "Static select for entity " + entityName + ": " + getSQLString() );

}
 
Example #17
Source File: AbstractLoadPlanBasedEntityLoader.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public AbstractLoadPlanBasedEntityLoader(
		OuterJoinLoadable entityPersister,
		SessionFactoryImplementor factory,
		String[] uniqueKeyColumnNames,
		Type uniqueKeyType,
		QueryBuildingParameters buildingParameters) {
	super( factory );
	this.entityPersister = entityPersister;
	this.uniqueKeyType = uniqueKeyType;
	this.entityName = entityPersister.getEntityName();

	final LoadPlanBuildingAssociationVisitationStrategy strategy;
	if ( buildingParameters.getQueryInfluencers().getFetchGraph() != null ) {
		strategy = new FetchGraphLoadPlanBuildingStrategy(
				factory, buildingParameters.getQueryInfluencers(),
				buildingParameters.getLockOptions() != null ? buildingParameters.getLockOptions().getLockMode() : buildingParameters.getLockMode()
		);
	}
	else if ( buildingParameters.getQueryInfluencers().getLoadGraph() != null ) {
		strategy = new LoadGraphLoadPlanBuildingStrategy(
				factory, buildingParameters.getQueryInfluencers(),
				buildingParameters.getLockOptions() != null ? buildingParameters.getLockOptions().getLockMode() : buildingParameters.getLockMode()
		);
	}
	else {
		strategy = new FetchStyleLoadPlanBuildingAssociationVisitationStrategy(
				factory, buildingParameters.getQueryInfluencers(),
				buildingParameters.getLockOptions() != null ? buildingParameters.getLockOptions().getLockMode() : buildingParameters.getLockMode()
		);
	}

	final LoadPlan plan = MetamodelDrivenLoadPlanBuilder.buildRootEntityLoadPlan( strategy, entityPersister );
	this.staticLoadQuery = BatchingLoadQueryDetailsFactory.INSTANCE.makeEntityLoadQueryDetails(
			plan,
			uniqueKeyColumnNames,
			buildingParameters,
			factory
	);
}
 
Example #18
Source File: LegacyBatchingEntityLoaderBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected UniqueEntityLoader buildBatchingLoader(
		OuterJoinLoadable persister,
		int batchSize,
		LockMode lockMode,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers influencers) {
	return new LegacyBatchingEntityLoader( persister, batchSize, lockMode, factory, influencers );
}
 
Example #19
Source File: EntityLoadQueryDetails.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected void applyRootReturnSelectFragments(SelectStatementBuilder selectStatementBuilder) {
	final OuterJoinLoadable outerJoinLoadable = (OuterJoinLoadable) getRootEntityReturn().getEntityPersister();
	selectStatementBuilder.appendSelectClauseFragment(
			outerJoinLoadable.selectFragment(
					entityReferenceAliases.getTableAlias(),
					entityReferenceAliases.getColumnAliases().getSuffix()

			)
	);
}
 
Example #20
Source File: JoinHelper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static String[] toColumns(OuterJoinLoadable persister, String columnQualifier, int propertyIndex) {
	if ( propertyIndex >= 0 ) {
		return persister.toColumns( columnQualifier, propertyIndex );
	}
	else {
		final String[] cols = persister.getIdentifierColumnNames();
		final String[] result = new String[cols.length];

		for ( int j = 0; j < cols.length; j++ ) {
			result[j] = StringHelper.qualify( columnQualifier, cols[j] );
		}

		return result;
	}
}
 
Example #21
Source File: DynamicBatchingEntityLoaderBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public DynamicBatchingEntityLoader(
		OuterJoinLoadable persister,
		int maxBatchSize,
		LockOptions lockOptions,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) {
	super( persister );
	this.maxBatchSize = maxBatchSize;
	this.singleKeyLoader = new EntityLoader( persister, 1, lockOptions, factory, loadQueryInfluencers );
	this.dynamicLoader = new DynamicEntityLoader( persister, maxBatchSize, lockOptions, factory, loadQueryInfluencers );
}
 
Example #22
Source File: DynamicBatchingEntityLoaderBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public DynamicBatchingEntityLoader(
		OuterJoinLoadable persister,
		int maxBatchSize,
		LockMode lockMode,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) {
	super( persister );
	this.maxBatchSize = maxBatchSize;
	this.singleKeyLoader = new EntityLoader( persister, 1, lockMode, factory, loadQueryInfluencers );
	this.dynamicLoader = new DynamicEntityLoader( persister, maxBatchSize, lockMode, factory, loadQueryInfluencers );
}
 
Example #23
Source File: DynamicBatchingEntityLoaderBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected UniqueEntityLoader buildBatchingLoader(
		OuterJoinLoadable persister,
		int batchSize,
		LockOptions lockOptions,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers influencers) {
	return new DynamicBatchingEntityLoader( persister, batchSize, lockOptions, factory, influencers );
}
 
Example #24
Source File: DynamicBatchingEntityLoaderBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected UniqueEntityLoader buildBatchingLoader(
		OuterJoinLoadable persister,
		int batchSize,
		LockMode lockMode,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers influencers) {
	return new DynamicBatchingEntityLoader( persister, batchSize, lockMode, factory, influencers );
}
 
Example #25
Source File: EntityLoader.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public EntityLoader(
		OuterJoinLoadable persister, 
		LockMode lockMode,
		SessionFactoryImplementor factory, 
		Map enabledFilters) 
throws MappingException {
	this(persister, 1, lockMode, factory, enabledFilters);
}
 
Example #26
Source File: JoinHelper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Determine the name of the table that is the left-hand-side of the join.  Usually this is the
 * name of the main table from the left-hand-side persister.  But that is not the case with property-refs.
 *
 * @param type The type representing the join
 * @param propertyIndex The property index for the type
 * @param lhsPersister The persister for the left-hand-side of the join
 *
 * @return The table name
 */
public static String getLHSTableName(
		AssociationType type,
		int propertyIndex,
		OuterJoinLoadable lhsPersister) {
	if ( type.useLHSPrimaryKey() || propertyIndex < 0 ) {
		return lhsPersister.getTableName();
	}
	else {
		final String propertyName = type.getLHSPropertyName();
		if ( propertyName == null ) {
			//if there is no property-ref, assume the join
			//is to the subclass table (ie. the table of the
			//subclass that the association belongs to)
			return lhsPersister.getSubclassPropertyTableName( propertyIndex );
		}
		else {
			//handle a property-ref
			String propertyRefTable = lhsPersister.getPropertyTableName( propertyName );
			if ( propertyRefTable == null ) {
				//it is possible that the tree-walking in OuterJoinLoader can get to
				//an association defined by a subclass, in which case the property-ref
				//might refer to a property defined on a subclass of the current class
				//in this case, the table name is not known - this temporary solution 
				//assumes that the property-ref refers to a property of the subclass
				//table that the association belongs to (a reasonable guess)
				//TODO: fix this, add: OuterJoinLoadable.getSubclassPropertyTableName(String propertyName)
				propertyRefTable = lhsPersister.getSubclassPropertyTableName( propertyIndex );
			}
			return propertyRefTable;
		}
	}
}
 
Example #27
Source File: DynamicBatchingEntityLoaderBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public List multiLoad(
		OuterJoinLoadable persister,
		Serializable[] ids,
		SharedSessionContractImplementor session,
		MultiLoadOptions loadOptions) {
	if ( loadOptions.isOrderReturnEnabled() ) {
		return performOrderedMultiLoad( persister, ids, session, loadOptions );
	}
	else {
		return performUnorderedMultiLoad( persister, ids, session, loadOptions );
	}
}
 
Example #28
Source File: EntityLoader.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public EntityLoader(
		OuterJoinLoadable persister,
		String[] uniqueKey,
		Type uniqueKeyType,
		int batchSize,
		LockOptions lockOptions,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
	super( persister, uniqueKeyType, factory, loadQueryInfluencers );

	EntityJoinWalker walker = new EntityJoinWalker(
			persister,
			uniqueKey,
			batchSize,
			lockOptions,
			factory,
			loadQueryInfluencers
	);
	initFromWalker( walker );
	this.compositeKeyManyToOneTargetIndices = walker.getCompositeKeyManyToOneTargetIndices();
	postInstantiate();

	batchLoader = batchSize > 1;

	if ( LOG.isDebugEnabled() ) {
		LOG.debugf( "Static select for entity %s [%s:%s]: %s",
				entityName,
				lockOptions.getLockMode(),
				lockOptions.getTimeOut(),
				getSQLString() );
	}
}
 
Example #29
Source File: FetchStrategyHelper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #30
Source File: BatchingEntityLoader.java    From webdsl with Apache License 2.0 5 votes vote down vote up
public static BatchingEntityLoader createBatchingEntityLoader(
			final OuterJoinLoadable persister,
			final SessionFactoryImplementor factory) throws MappingException {
			int[] batchSizesToCreate = ArrayHelper.getBatchSizes(DEFAULT_MAX_BATCH_SIZE);
      //System.out.print("created loader");
			Loader[] loadersToCreate = new Loader[ batchSizesToCreate.length ];
			for ( int i=0; i<batchSizesToCreate.length; i++ ) {
				loadersToCreate[i] = new EntityLoader(persister, batchSizesToCreate[i], LockMode.NONE, factory, LoadQueryInfluencers.NONE);
//        System.out.print(", " + batchSizesToCreate[i]);
			}
//      org.webdsl.logging.Logger.info();
			return new BatchingEntityLoader(persister, batchSizesToCreate, loadersToCreate);
	}