improve error messages

This commit is contained in:
Gavin King 2022-02-08 14:25:53 +01:00
parent 0dfa91f6ec
commit bd5b05cbe3
1 changed files with 2 additions and 2 deletions

View File

@ -3996,13 +3996,13 @@ public class SemanticQueryBuilder<R> extends HqlParserBaseVisitor<Object> implem
final SqmFrom<?, ?> sqmFrom = processingStateStack.getCurrent().getPathRegistry().findFromByAlias( alias ); final SqmFrom<?, ?> sqmFrom = processingStateStack.getCurrent().getPathRegistry().findFromByAlias( alias );
if ( sqmFrom == null ) { if ( sqmFrom == null ) {
throw new ParsingException( "Could not resolve identification variable [" + alias + "] to SqmFrom" ); throw new ParsingException( "Alias '" + alias + "' did not resolve to a declared identification variable" );
} }
final SqmPathSource<?> pluralAttribute = sqmFrom.getReferencedPathSource(); final SqmPathSource<?> pluralAttribute = sqmFrom.getReferencedPathSource();
if ( !( pluralAttribute instanceof PluralPersistentAttribute<?, ?, ?> ) ) { if ( !( pluralAttribute instanceof PluralPersistentAttribute<?, ?, ?> ) ) {
throw new ParsingException( "Could not resolve identification variable [" + alias + "] as plural-attribute" ); throw new ParsingException( "Alias '" + alias + "' did not resolve to a many-valued attribute" );
} }
return sqmFrom.resolvePathPart( CollectionPart.Nature.INDEX.getName(), true, this ); return sqmFrom.resolvePathPart( CollectionPart.Nature.INDEX.getName(), true, this );