hibernate/hibernate-orm · error · FunctionArgumentException

Path '" + ctx.path().getText() + "' did not resolve to a man

Error message

Path '" + ctx.path().getText() + "' did not resolve to a many-valued attribute

What it means

Error "Path '" + ctx.path().getText() + "' did not resolve to a many-valued attribute" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:5655

		// the actual function name might be 'minelement' or 'maxelement', so trim it
		final String functionName = ctx.getChild(0).getText().substring(0, 3);

		final var path = consumePluralAttributeReference( ctx.path() );
		if ( path instanceof SqmPluralValuedSimplePath<?> pluralPath ) {
			return new SqmElementAggregateFunction<>( pluralPath, functionName );
		}
		else {
			// elements() and values() and only apply to compound paths
			if ( path instanceof SqmMapJoin ) {
				throw new FunctionArgumentException( "Path '" + ctx.path().getText()
						+ "' resolved to a joined map instead of a compound path" );
			}
			else if ( path instanceof SqmListJoin ) {
				throw new FunctionArgumentException( "Path '" + ctx.path().getText()
						+ "' resolved to a joined list instead of a compound path" );
			}
			else {
				throw new FunctionArgumentException( "Path '" + ctx.path().getText()
						+ "' did not resolve to a many-valued attribute" );
			}
		}
	}

	@Override
	public SqmExpression<?> visitIndexAggregateFunction(HqlParser.IndexAggregateFunctionContext ctx) {
		if ( creationOptions.useStrictJpaCompliance() ) {
			throw new StrictJpaComplianceViolation( StrictJpaComplianceViolation.Type.HQL_COLLECTION_FUNCTION );
		}

		// the actual function name might be 'minindex' or 'maxindex', so trim it
		final String functionName = ctx.getChild(0).getText().substring(0, 3);

		final var path = consumePluralAttributeReference( ctx.path() );
		if ( path instanceof SqmPluralValuedSimplePath<?> pluralPath ) {
			if ( isIndexedPluralAttribute( pluralPath ) ) {
				return new SqmIndexAggregateFunction<>( pluralPath, functionName );

View on GitHub (pinned to fad1729dce)

Solutions

  1. The path used with the index/collection operation does not resolve to a many-valued (collection) attribute. Verify the path points to a collection-valued association.

When it happens

Trigger: A collection-typed path is required but not found: Path '" + ctx.path().getText() + "' did not resolve to a many-valued attribute

Common situations: Applying collection operations (elements/indices/key/value/index, slice, member of) to singular paths, or to joined lists/maps that are not compound/indexed paths.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/bc79dc693a7af4a3. Report an issue: GitHub.