hibernate/hibernate-orm · error · PathException

Expecting ManagedType or @Any valued path [" + sqmPath.getNa

Error message

Expecting ManagedType or @Any valued path [" + sqmPath.getNavigablePath() + "], but found: " + pathType

What it means

Error "Expecting ManagedType or @Any valued path [" + sqmPath.getNavigablePath() + "], but found: " + pathType" thrown in hibernate/hibernate-orm.

Source

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

	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<?> ) {
			return sqmPath;
		}
		else {
			throw new PathException( "Expecting ManagedType or @Any valued path ["
						+ sqmPath.getNavigablePath() + "], but found: " + pathType );
		}
	}

	private SqmPath<?> consumePluralAttributeReference(HqlParser.PathContext parserPath) {
		final var sqmPath = consumeDomainPath( parserPath );
		final var pathSource = sqmPath.getReferencedPathSource();
		if ( pathSource instanceof PluralPersistentAttribute ) {
			return sqmPath;
		}
		else {
			throw new PathException( "Expecting plural attribute valued path ["
						+ sqmPath.getNavigablePath() + "], but found: "
						+ pathSource.getPathType() );
		}
	}

	private void checkFQNEntityNameJpaComplianceViolationIfNeeded(String name, EntityDomainType<?> entityDescriptor) {

View on GitHub (pinned to fad1729dce)

Solutions

  1. The path must resolve to a managed type or an @Any-valued attribute. Check the mapping of the referenced attribute.

When it happens

Trigger: A runtime precondition of the Hibernate query API is violated: Expecting ManagedType or @Any valued path [" + sqmPath.getNavigablePath() + "], but found: " + pathType

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