if ( joinType != NONE ) throw new QueryException( "outer or full join must be followed by path expression" );
if ( afterClass ) {
// treat it as a classname
Queryable p = q.getEntityPersisterUsingImports( token );
if ( p == null ) throw new QueryException( "persister not found: " + token );
q.addFromClass( alias, p );
}
else {
// treat it as a path expression
peParser.setJoinType( JoinFragment.INNER_JOIN );
peParser.setUseThetaStyleJoin( true );
ParserHelper.parse( peParser, q.unalias( token ), ParserHelper.PATH_SEPARATORS, q );
if ( !peParser.isCollectionValued() ) throw new QueryException( "path expression did not resolve to collection: " + token );
String nm = peParser.addFromCollection( q );
q.setAliasName( alias, nm );
}
alias = null;
afterIn = false;
afterClass = false;
expectingJoin = true;
}
else {
// handle a path expression or class name that
// appears at the start, in the "new" HQL
// style or an alias that appears at the start
// in the "old" HQL style
Queryable p = q.getEntityPersisterUsingImports( token );
if ( p != null ) {
// starts with the name of a mapped class (new style)
if ( joinType != NONE ) throw new QueryException( "outer or full join must be followed by path expression" );
entityName = q.createNameFor( p.getEntityName() );
q.addFromClass( entityName, p );
expectingAs = true;
}
else if ( token.indexOf( '.' ) < 0 ) {
// starts with an alias (old style)