hibernate/hibernate-orm · error · FunctionArgumentException

Path '{ctx.path().getText()}' resolved to a joined map inste

Error message

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

What it means

Error "Path '{ctx.path().getText()}' resolved to a joined map instead of a compound path" thrown in hibernate/hibernate-orm.

Source

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

	}

	@Override
	public SqmExpression<?> visitElementAggregateFunction(HqlParser.ElementAggregateFunctionContext ctx) {
		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 );
		}

View on GitHub (pinned to fad1729dce)

Solutions

  1. The path resolved to a joined map where a compound path was expected. Navigate the map with key()/value()/entry() or index it explicitly instead of treating it as a compound path.

When it happens

Trigger: A runtime precondition of the Hibernate query API is violated: Path '<value>' resolved to a joined map 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/7d0b47dc8a2be107. Report an issue: GitHub.