hibernate/hibernate-orm · error · FunctionArgumentException

Path ' ' resolved to a joined list instead of a compound…

Error message

Path '{ctx.path().getText()}' resolved to a joined list instead of a compound path

What it means

Thrown by SemanticQueryBuilder.visitElementAggregateFunction (maxelement/minelement) when the argument path resolved to an SqmListJoin rather than a compound plural path. Element aggregation requires a many-valued attribute path, not a joined list; the offending input is the path expression passed to the function.

Solutions

  1. The path resolved to a joined list where a compound path was expected. Use an index or join the list elements explicitly.
Defensive patterns

Strategy: validation

When it happens

Trigger: A runtime precondition of the Hibernate query API is violated: Path '<value>' resolved to a joined list instead of a compound path

Common situations: Application code or configuration calls the query API in a way that violates its documented contract; the interpolated values in the message identify the offending input.


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

Appendix: source

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

		if ( creationOptions.useStrictJpaCompliance() ) {
			throw new StrictJpaComplianceViolation( StrictJpaComplianceViolation.Type.HQL_COLLECTION_FUNCTION );
		}

		// 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);

View on GitHub (pinned to fad1729dce)