hibernate/hibernate-orm · error · FunctionArgumentException

Path '" + ctx.path().getText() + "' resolved to a joined map

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:5685

		// 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 );
			}
			else {
				throw new FunctionArgumentException( "Path '" + ctx.path()
						+  "' resolved to '"
						+ pluralPath.getReferencedPathSource()
						+ "' which is not an indexed collection" );
			}
		}
		else {
			// indices() and keys() 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 SqmSubQuery<?> visitSubqueryExpression(HqlParser.SubqueryExpressionContext ctx) {
		return visitSubquery( (HqlParser.SubqueryContext) ctx.getChild( 1 ) );
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. The path resolved to a joined map where a compound path was expected. Use key()/value()/entry() or explicit map indexing.

When it happens

Trigger: A runtime precondition of the Hibernate query API is violated: Path '" + ctx.path().getText() + "' 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/4d4849e430f6f894. Report an issue: GitHub.