org.hibernate.persister.collection.QueryableCollection Java Examples

The following examples show how to use org.hibernate.persister.collection.QueryableCollection. 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: SizeExpression.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
throws HibernateException {
	String role = criteriaQuery.getEntityName(criteria, propertyName) + 
			'.' +  
			criteriaQuery.getPropertyName(propertyName);
	QueryableCollection cp = (QueryableCollection) criteriaQuery.getFactory()
			.getCollectionPersister(role);
	//String[] fk = StringHelper.qualify( "collection_", cp.getKeyColumnNames() );
	String[] fk = cp.getKeyColumnNames();
	String[] pk = ( (Loadable) cp.getOwnerEntityPersister() ).getIdentifierColumnNames(); //TODO: handle property-ref
	return "? " + 
			op + 
			" (select count(*) from " +
			cp.getTableName() +
			//" collection_ where " +
			" where " +
			new ConditionFragment()
					.setTableAlias( criteriaQuery.getSQLAlias(criteria, propertyName) )
					.setCondition(pk, fk)
					.toFragmentString() +
			")";
}
 
Example #2
Source File: CollectionType.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public String getAssociatedEntityName(SessionFactoryImplementor factory)
		throws MappingException {
	try {
		
		QueryableCollection collectionPersister = (QueryableCollection) factory
				.getCollectionPersister( role );
		
		if ( !collectionPersister.getElementType().isEntityType() ) {
			throw new MappingException( 
					"collection was not an association: " + 
					collectionPersister.getRole() 
				);
		}
		
		return collectionPersister.getElementPersister().getEntityName();
		
	}
	catch (ClassCastException cce) {
		throw new MappingException( "collection role is not queryable " + role );
	}
}
 
Example #3
Source File: MapEntryNode.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private void determineValueSelectExpressions(QueryableCollection collectionPersister, List selections) {
	AliasGenerator aliasGenerator = new LocalAliasGenerator( 1 );
	appendSelectExpressions( collectionPersister.getElementColumnNames(), selections, aliasGenerator );
	Type valueType = collectionPersister.getElementType();
	if ( valueType.isAssociationType() ) {
		EntityType valueEntityType = (EntityType) valueType;
		Queryable valueEntityPersister = (Queryable) sfi().getEntityPersister(
				valueEntityType.getAssociatedEntityName( sfi() )
		);
		SelectFragment fragment = valueEntityPersister.propertySelectFragmentFragment(
				elementTableAlias(),
				null,
				false
		);
		appendSelectExpressions( fragment, selections, aliasGenerator );
	}
}
 
Example #4
Source File: BatchingCollectionInitializer.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public static CollectionInitializer createBatchingCollectionInitializer(
	final QueryableCollection persister,
	final int maxBatchSize,
	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 BasicCollectionLoader(persister, batchSizesToCreate[i], factory, enabledFilters);
		}
		return new BatchingCollectionInitializer(persister, batchSizesToCreate, loadersToCreate);
	}
	else {
		return new BasicCollectionLoader(persister, factory, enabledFilters);
	}
}
 
Example #5
Source File: SubselectOneToManyLoader.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public SubselectOneToManyLoader(
		QueryableCollection persister, 
		String subquery,
		Collection entityKeys,
		QueryParameters queryParameters,
		Map namedParameterLocMap,
		SessionFactoryImplementor factory, 
		Map enabledFilters)
throws MappingException {
	
	super(persister, 1, subquery, factory, enabledFilters);

	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 #6
Source File: AbstractEmptinessExpression.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
protected QueryableCollection getQueryableCollection(
		String entityName,
		String propertyName,
		SessionFactoryImplementor factory) throws HibernateException {
	final PropertyMapping ownerMapping = (PropertyMapping) factory.getEntityPersister( entityName );
	final Type type = ownerMapping.toType( propertyName );
	if ( !type.isCollectionType() ) {
		throw new MappingException(
				"Property path [" + entityName + "." + propertyName + "] does not reference a collection"
		);
	}

	final String role = ( (CollectionType) type ).getRole();
	try {
		return (QueryableCollection) factory.getCollectionPersister( role );
	}
	catch ( ClassCastException cce ) {
		throw new QueryException( "collection role is not queryable: " + role );
	}
	catch ( Exception e ) {
		throw new QueryException( "collection role not found: " + role );
	}
}
 
Example #7
Source File: BasicCollectionJoinWalker.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
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: SubselectOneToManyLoader.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public SubselectOneToManyLoader(
		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 #9
Source File: ReactiveDynamicBatchingCollectionDelegator.java    From hibernate-reactive with GNU Lesser General Public License v2.1 6 votes vote down vote up
public ReactiveDynamicBatchingCollectionDelegator(
			QueryableCollection collectionPersister,
			int maxBatchSize,
			SessionFactoryImplementor factory,
			LoadQueryInfluencers influencers) {
		super( collectionPersister, factory, influencers );
		this.maxBatchSize = maxBatchSize;

		if ( collectionPersister.isOneToMany() ) {
			this.singleKeyLoader = new ReactiveOneToManyLoader( collectionPersister, 1, factory, influencers );
		}
		else {
			throw new UnsupportedOperationException();
//				this.singleKeyLoader = new ReactiveBasicCollectionLoader( collectionPersister, 1, factory, influencers );
		}

		this.batchLoader = new ReactiveDynamicBatchingCollectionInitializer( collectionPersister, factory, influencers );
	}
 
Example #10
Source File: BasicCollectionLoader.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
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 #11
Source File: OuterJoinableAssociation.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public void addManyToManyJoin(JoinFragment outerjoin, QueryableCollection collection) throws MappingException {
	String manyToManyFilter = collection.getManyToManyFilterFragment( rhsAlias, enabledFilters );
	String condition = "".equals( manyToManyFilter )
			? on
			: "".equals( on )
			? manyToManyFilter
			: on + " and " + manyToManyFilter;
	outerjoin.addJoin(
			joinable.getTableName(),
			rhsAlias,
			lhsColumns,
			rhsColumns,
			joinType,
			condition
	);
	outerjoin.addJoins(
			joinable.fromJoinFragment( rhsAlias, false, true ),
			joinable.whereJoinFragment( rhsAlias, false, true )
	);
}
 
Example #12
Source File: CollectionType.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String getAssociatedEntityName(SessionFactoryImplementor factory)
		throws MappingException {
	try {

		QueryableCollection collectionPersister = (QueryableCollection) factory
				.getCollectionPersister( role );

		if ( !collectionPersister.getElementType().isEntityType() ) {
			throw new MappingException(
					"collection was not an association: " +
					collectionPersister.getRole()
			);
		}

		return collectionPersister.getElementPersister().getEntityName();

	}
	catch (ClassCastException cce) {
		throw new MappingException( "collection role is not queryable " + role );
	}
}
 
Example #13
Source File: CollectionQuerySpaceImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public String[] toAliasedColumns(String alias, String propertyName) {
	final QueryableCollection queryableCollection = (QueryableCollection) persister;
	if ( propertyName.equals( CollectionPropertyNames.COLLECTION_ELEMENTS ) ) {
		return queryableCollection.getElementColumnNames( alias );
	}
	else if ( propertyName.equals( CollectionPropertyNames.COLLECTION_INDICES ) ) {
		return queryableCollection.getIndexColumnNames( alias );
	}
	else {
		throw new IllegalArgumentException(
				String.format(
						"Collection propertyName must be either %s or %s; instead it was %s.",
						CollectionPropertyNames.COLLECTION_ELEMENTS,
						CollectionPropertyNames.COLLECTION_INDICES,
						propertyName
				)
		);
	}
}
 
Example #14
Source File: SessionFactoryHelper.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Locate the collection persister by the collection role, requiring that
 * such a persister exist.
 *
 * @param role The collection role name.
 *
 * @return The defined CollectionPersister for this collection role.
 *
 * @throws QueryException Indicates that the collection persister could not be found.
 */
public QueryableCollection requireQueryableCollection(String role) throws QueryException {
	try {
		QueryableCollection queryableCollection = (QueryableCollection) sfi.getMetamodel().collectionPersister( role );
		if ( queryableCollection != null ) {
			collectionPropertyMappingByRole.put( role, new CollectionPropertyMapping( queryableCollection ) );
		}
		return queryableCollection;
	}
	catch ( ClassCastException cce ) {
		throw new QueryException( "collection role is not queryable: " + role );
	}
	catch ( Exception e ) {
		throw new QueryException( "collection role not found: " + role );
	}
}
 
Example #15
Source File: MetamodelGraphWalker.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private void visitCollectionElements(CollectionDefinition collectionDefinition) {
	final CollectionElementDefinition elementDefinition = collectionDefinition.getElementDefinition();
	strategy.startingCollectionElements( elementDefinition );

	final Type collectionElementType = elementDefinition.getType();
	if ( collectionElementType.isAnyType() ) {
		visitAnyDefinition( elementDefinition.toAnyMappingDefinition() );
	}
	else if ( collectionElementType.isComponentType() ) {
		visitCompositeDefinition( elementDefinition.toCompositeElementDefinition() );
	}
	else if ( collectionElementType.isEntityType() ) {
		if ( ! collectionDefinition.getCollectionPersister().isOneToMany() ) {
			final QueryableCollection queryableCollection = (QueryableCollection) collectionDefinition.getCollectionPersister();
			addAssociationKey(
					new AssociationKey(
							queryableCollection.getTableName(),
							queryableCollection.getElementColumnNames()
					)
			);
		}
		visitEntityDefinition( elementDefinition.toEntityDefinition() );
	}

	strategy.finishingCollectionElements( elementDefinition );
}
 
Example #16
Source File: AbstractEmptinessExpression.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public final String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException {
	String entityName = criteriaQuery.getEntityName( criteria, propertyName );
	String actualPropertyName = criteriaQuery.getPropertyName( propertyName );
	String sqlAlias = criteriaQuery.getSQLAlias( criteria, propertyName );

	SessionFactoryImplementor factory = criteriaQuery.getFactory();
	QueryableCollection collectionPersister = getQueryableCollection( entityName, actualPropertyName, factory );

	String[] collectionKeys = collectionPersister.getKeyColumnNames();
	String[] ownerKeys = ( ( Loadable ) factory.getEntityPersister( entityName ) ).getIdentifierColumnNames();

	String innerSelect = "(select 1 from " + collectionPersister.getTableName()
	        + " where "
	        + new ConditionFragment().setTableAlias( sqlAlias ).setCondition( ownerKeys, collectionKeys ).toFragmentString()
	        + ")";

	return excludeEmpty()
	        ? "exists " + innerSelect
	        : "not exists " + innerSelect;
}
 
Example #17
Source File: IndexNode.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void prepareForDot(String propertyName) throws SemanticException {
	FromElement fromElement = getFromElement();
	if ( fromElement == null ) {
		throw new IllegalStateException( "No FROM element for index operator!" );
	}
	QueryableCollection queryableCollection = fromElement.getQueryableCollection();
	if ( queryableCollection != null && !queryableCollection.isOneToMany() ) {

		FromReferenceNode collectionNode = ( FromReferenceNode ) getFirstChild();
		String path = collectionNode.getPath() + "[]." + propertyName;
		if ( log.isDebugEnabled() ) {
			log.debug( "Creating join for many-to-many elements for " + path );
		}
		FromElementFactory factory = new FromElementFactory( fromElement.getFromClause(), fromElement, path );
		// This will add the new from element to the origin.
		FromElement elementJoin = factory.createElementJoin( queryableCollection );
		setFromElement( elementJoin );
	}
}
 
Example #18
Source File: OuterJoinableAssociation.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public boolean isManyToManyWith(OuterJoinableAssociation other) {
	if ( joinable.isCollection() ) {
		QueryableCollection persister = (QueryableCollection) joinable;
		if ( persister.isManyToMany() ) {
			return persister.getElementType() == other.getJoinableType();
		}
	}
	return false;
}
 
Example #19
Source File: JoinSequence.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
private boolean isManyToManyRoot(Joinable joinable) {
	if ( joinable != null && joinable.isCollection() ) {
		QueryableCollection persister = ( QueryableCollection ) joinable;
		return persister.isManyToMany();
	}
	return false;
}
 
Example #20
Source File: BasicCollectionLoader.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public BasicCollectionLoader(
		QueryableCollection collectionPersister,
		int batchSize,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers loadQueryInfluencers) throws MappingException {
	this( collectionPersister, batchSize, null, factory, loadQueryInfluencers );
}
 
Example #21
Source File: CompositionSingularSubAttributesHelper.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public static Iterable<AttributeDefinition> getCompositeCollectionIndexSubAttributes(CompositeCollectionElementDefinition compositionElementDefinition){
	final QueryableCollection collectionPersister =
			(QueryableCollection) compositionElementDefinition.getCollectionDefinition().getCollectionPersister();
	return getSingularSubAttributes(
			compositionElementDefinition.getSource(),
			(OuterJoinLoadable) collectionPersister.getOwnerEntityPersister(),
			(CompositeType) collectionPersister.getIndexType(),
			collectionPersister.getTableName(),
			collectionPersister.toColumns( "index" )
	);
}
 
Example #22
Source File: PathExpressionParser.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void dereferenceCollection(String propertyName, String role, QueryTranslatorImpl q) throws QueryException {
	collectionRole = role;
	QueryableCollection collPersister = q.getCollectionPersister( role );
	String name = q.createNameForCollection( role );
	addJoin( name, collPersister.getCollectionType() );
	//if ( collPersister.hasWhere() ) join.addCondition( collPersister.getSQLWhereString(name) );
	collectionName = name;
	collectionOwnerName = currentName;
	currentName = name;
	currentProperty = propertyName;
	componentPath.setLength( 0 );
	currentPropertyMapping = new CollectionPropertyMapping( collPersister );
}
 
Example #23
Source File: DynamicBatchingCollectionInitializerBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected CollectionInitializer createRealBatchingCollectionInitializer(
		QueryableCollection persister,
		int maxBatchSize,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers influencers) {
	return new DynamicBatchingCollectionInitializer( persister, maxBatchSize, factory, influencers );
}
 
Example #24
Source File: OneToManyJoinWalker.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
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 #25
Source File: BatchingCollectionInitializerBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Builds a batch-fetch capable CollectionInitializer for one-to-many collections (collections without
 * a dedicated collection table).
 *
 * @param persister THe collection persister
 * @param maxBatchSize The maximum number of keys to batch-fetch together
 * @param factory The SessionFactory
 * @param influencers Any influencers that should affect the built query
 *
 * @return The batch-fetch capable collection initializer
 */
public CollectionInitializer createBatchingOneToManyInitializer(
		QueryableCollection persister,
		int maxBatchSize,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers influencers) {
	if ( maxBatchSize <= 1 ) {
		// no batching
		return buildNonBatchingLoader( persister, factory, influencers );
	}

	return createRealBatchingOneToManyInitializer( persister, maxBatchSize, factory, influencers );
}
 
Example #26
Source File: BatchingCollectionInitializerBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Builds a batch-fetch capable CollectionInitializer for basic and many-to-many collections (collections with
 * a dedicated collection table).
 *
 * @param persister THe collection persister
 * @param maxBatchSize The maximum number of keys to batch-fetch together
 * @param factory The SessionFactory
 * @param influencers Any influencers that should affect the built query
 *
 * @return The batch-fetch capable collection initializer
 */
public CollectionInitializer createBatchingCollectionInitializer(
		QueryableCollection persister,
		int maxBatchSize,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers influencers) {
	if ( maxBatchSize <= 1 ) {
		// no batching
		return buildNonBatchingLoader( persister, factory, influencers );
	}

	return createRealBatchingCollectionInitializer( persister, maxBatchSize, factory, influencers );
}
 
Example #27
Source File: IdentNode.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected String[] resolveColumns(QueryableCollection collectionPersister) {
	final FromElement fromElement = getFromElement();
	return fromElement.toColumns(
			fromElement.getCollectionTableAlias(),
			"elements", // the JPA VALUE "qualifier" is the same concept as the HQL ELEMENTS function/property
			getWalker().isInSelect()
	);
}
 
Example #28
Source File: JoinSequence.java    From Knowage-Server with GNU Affero General Public License v3.0 5 votes vote down vote up
private boolean isManyToManyRoot(Joinable joinable) {
	if ( joinable != null && joinable.isCollection() ) {
		QueryableCollection persister = ( QueryableCollection ) joinable;
		return persister.isManyToMany();
	}
	return false;
}
 
Example #29
Source File: DynamicBatchingCollectionInitializerBuilder.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected CollectionInitializer createRealBatchingOneToManyInitializer(
		QueryableCollection persister,
		int maxBatchSize,
		SessionFactoryImplementor factory,
		LoadQueryInfluencers influencers) {
	return new DynamicBatchingCollectionInitializer( persister, maxBatchSize, factory, influencers );
}
 
Example #30
Source File: QueryTranslatorImpl.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Used for collection filters
 */
private void addFromAssociation(final String elementName, final String collectionRole)
		throws QueryException {
	//q.addCollection(collectionName, collectionRole);
	QueryableCollection persister = getCollectionPersister( collectionRole );
	Type collectionElementType = persister.getElementType();
	if ( !collectionElementType.isEntityType() ) {
		throw new QueryException( "collection of values in filter: " + elementName );
	}

	String[] keyColumnNames = persister.getKeyColumnNames();
	//if (keyColumnNames.length!=1) throw new QueryException("composite-key collection in filter: " + collectionRole);

	String collectionName;
	JoinSequence join = new JoinSequence( getFactory() );
	collectionName = persister.isOneToMany() ?
			elementName :
			createNameForCollection( collectionRole );
	join.setRoot( persister, collectionName );
	if ( !persister.isOneToMany() ) {
		//many-to-many
		addCollection( collectionName, collectionRole );
		try {
			join.addJoin( ( AssociationType ) persister.getElementType(),
					elementName,
					JoinFragment.INNER_JOIN,
					persister.getElementColumnNames(collectionName) );
		}
		catch ( MappingException me ) {
			throw new QueryException( me );
		}
	}
	join.addCondition( collectionName, keyColumnNames, " = ?" );
	//if ( persister.hasWhere() ) join.addCondition( persister.getSQLWhereString(collectionName) );
	EntityType elemType = ( EntityType ) collectionElementType;
	addFrom( elementName, elemType.getAssociatedEntityName(), join );

}