hibernate/hibernate-orm · error · SemanticException

Path is not a plural path '{pluralAttributePath.getNavigable

Error message

Path is not a plural path '{pluralAttributePath.getNavigablePath()}'

What it means

Error "Path is not a plural path '{pluralAttributePath.getNavigablePath()}'" thrown in hibernate/hibernate-orm.

Source

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

			return new SqmAny<>(
					createCollectionReferenceSubQuery(
							ctx.simplePath(),
							(TerminalNode) ctx.collectionQuantifier().getChild(0).getChild(0)
					),
					nodeBuilder()
			);
		}
	}

	private <X> SqmSubQuery<X> createCollectionReferenceSubQuery(
			HqlParser.SimplePathContext pathCtx,
			TerminalNode collectionReferenceCtx) {
		final var pluralAttributePath = consumeDomainPath( pathCtx );
		final var referencedPathSource = pluralAttributePath.getReferencedPathSource();

		if ( !(referencedPathSource instanceof PluralPersistentAttribute ) ) {
			//TODO: improve this message
			throw new SemanticException( "Path is not a plural path '" + pluralAttributePath.getNavigablePath() + "'",
					query );
		}
		final SqmSubQuery<X> subQuery = new SqmSubQuery<>(
				processingStateStack.getCurrent().getProcessingQuery(),
				nodeBuilder()
		);
		final var selectClause = new SqmSelectClause( false, 1, nodeBuilder() );
		final var fromClause = new SqmFromClause( 1 );
		SqmPath<?> lhs = pluralAttributePath.getLhs();
		final List<String> implicitJoinPaths = new ArrayList<>();
		while ( !(lhs instanceof AbstractSqmFrom<?, ?> correlationBase) ) {
			implicitJoinPaths.add( lhs.getNavigablePath().getLocalName() );
			lhs = lhs.getLhs();
		}
		final var correlation = correlationBase.createCorrelation();
		SqmFrom<?, ?> joinBase = correlation;
		for ( int i = implicitJoinPaths.size() - 1; i >= 0; i-- ) {
			joinBase = joinBase.join( implicitJoinPaths.get( i ) );

View on GitHub (pinned to fad1729dce)

Solutions

  1. The function expects a plural (collection-valued) path, but the given path resolves to a singular attribute. Pass a collection-valued association path.

When it happens

Trigger: A collection-typed path is required but not found: Path is not a plural path '<value>'

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/5f8e96430f32b338. Report an issue: GitHub.