JoinSequence ojf = q.getPathJoin( path.toString() );
try {
joinSequence.addCondition( ojf.toJoinFragment( q.getEnabledFilters(), true ).toWhereFragmentString() ); //after reset!
}
catch ( MappingException me ) {
throw new QueryException( me );
}
// we don't need to worry about any condition in the ON clause
// here (toFromFragmentString), since anything in the ON condition
// is already applied to the whole query
}
}
else if ( ".".equals( token ) ) {
dotcount++;
}
else {
if ( dotcount == 0 ) {
if ( !continuation ) {
if ( !q.isName( token ) ) throw new QueryException( "undefined alias: " + token );
currentName = token;
currentPropertyMapping = q.getPropertyMapping( currentName );
}
}
else if ( dotcount == 1 ) {
if ( currentName != null ) {
currentProperty = token;
}
else if ( collectionName != null ) {
//processCollectionProperty(token, q.getCollectionPersister(collectionRole), collectionName);
continuation = false;
}
else {
throw new QueryException( "unexpected" );
}
}
else { // dotcount>=2
// Do the corresponding RHS
Type propertyType = getPropertyType();
if ( propertyType == null ) {
throw new QueryException( "unresolved property: " + path );
}
if ( propertyType.isComponentType() ) {
dereferenceComponent( token );
}
else if ( propertyType.isEntityType() ) {
if ( !isCollectionValued() ) dereferenceEntity( token, ( EntityType ) propertyType, q );
}
else if ( propertyType.isCollectionType() ) {
dereferenceCollection( token, ( ( CollectionType ) propertyType ).getRole(), q );
}
else {
if ( token != null ) throw new QueryException( "dereferenced: " + path );
}
}
}
}