hibernate/hibernate-orm · error · SemanticException

Cannot resolve path '" + path + "'

Error message

Cannot resolve path '" + path + "'

What it means

SemanticException from resolveFrom(SqmPath): neither the path itself nor any lhs of it maps to a registered from-element with an alias, so the from-element for the path cannot be recovered.

Solutions

  1. The path cannot be resolved from the registered roots/joins. Verify the path root is in scope and each step is a mapped attribute.
Defensive patterns

Strategy: validation

When it happens

Trigger: A path in the query cannot be resolved: Cannot resolve path '" + path + "'

Common situations: Referencing attributes/paths that do not exist on the query roots, often after renaming entity attributes.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/1092711e914cea84. Report an issue: GitHub.

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SqmPathRegistryImpl.java:326

		final X from = findFromByPath( navigablePath );
		if ( from == null ) {
			throw new SemanticException( "Cannot resolve find from by navigable path '" + navigablePath + "'" );
		}
		return from;
	}

	@Override
	public <X extends SqmFrom<?, ?>> X resolveFrom(SqmPath<?> path) {
		final var navigablePath = path.getNavigablePath();
		final var existing = sqmFromByPath.get( navigablePath );
		if ( existing != null ) {
			//noinspection unchecked
			return (X) existing;
		}
		else {
			final var lhs = path.getLhs();
			if ( lhs == null ) {
				throw new SemanticException( "Cannot resolve path '" + path + "'" );
			}
			final var sqmFrom = resolveFrom( lhs ).join( path.getNavigablePath().getLocalName() );
			register( sqmFrom );
			//noinspection unchecked
			return (X) sqmFrom;
		}
	}

	private boolean definesAttribute(SqmPathSource<?> containerType, String name) {
		return !( containerType.getSqmType() instanceof BasicDomainType )
			&& containerType.findSubPathSource( name, true ) != null;
	}

	@Override
	public @Nullable SqmAliasedNode<?> findAliasedNodeByAlias(String alias) {
		assert alias != null;
		final String aliasToUse = handleAliasCaseSensitivity( alias );
		for ( int i = 0; i < simpleSelectionNodes.size(); i++ ) {

View on GitHub (pinned to fad1729dce)