hibernate/hibernate-orm · error · PathException

Expecting domain-model path, but found: " + consumedPart

Error message

Expecting domain-model path, but found: " + consumedPart

What it means

Error "Expecting domain-model path, but found: " + consumedPart" thrown in hibernate/hibernate-orm.

Source

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

	private void checkPluralPath(SqmPath<?> pluralAttributePath, SqmPathSource<?> referencedPathSource, TerminalNode firstNode) {
		if ( !( referencedPathSource instanceof PluralPersistentAttribute<?, ?, ?> ) ) {
			throw new FunctionArgumentException(
					String.format(
							"Argument of '%s' is not a plural path '%s'",
							firstNode.getSymbol().getText(),
							pluralAttributePath.getNavigablePath()
					)
			);
		}
	}

	private SqmPath<?> consumeDomainPath(HqlParser.PathContext parserPath) {
		final var consumedPart = (SemanticPathPart) parserPath.accept( this );
		if ( consumedPart instanceof SqmPath<?> sqmPath ) {
			return sqmPath;
		}
		else {
			throw new PathException( "Expecting domain-model path, but found: " + consumedPart );
		}
	}


	private SqmPath<?> consumeDomainPath(HqlParser.SimplePathContext sequence) {
		final var consumedPart = (SemanticPathPart) sequence.accept( this );
		if ( consumedPart instanceof SqmPath<?> sqmPath ) {
			return sqmPath;
		}
		else {
			throw new PathException( "Expecting domain-model path, but found: " + consumedPart );
		}
	}

	private SqmPath<?> consumeManagedTypeReference(HqlParser.PathContext parserPath) {
		final var sqmPath = consumeDomainPath( parserPath );
		final var pathType = sqmPath.getReferencedPathSource().getPathType();
		if ( pathType instanceof ManagedDomainType<?> || pathType instanceof AnyMappingDomainType<?> ) {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Expected a domain-model path but found something else. Ensure the path starts from an identification variable or entity root and navigates mapped attributes.

When it happens

Trigger: A runtime precondition of the Hibernate query API is violated: Expecting domain-model path, but found: " + consumedPart

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/23d6f5ce8925c046. Report an issue: GitHub.