hibernate/hibernate-orm · error · SemanticException

Ambiguous unqualified attribute reference '" + navigableName

Error message

Ambiguous unqualified attribute reference '" + navigableName + "' (qualify the attribute reference by an identification variable)

What it means

Error "Ambiguous unqualified attribute reference '" + navigableName + "' (qualify the attribute reference by an identification variable)" thrown in hibernate/hibernate-orm.

Source

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

			return selectQuery.correlate( join );
		}
		else {
			throw new UnsupportedOperationException( "Can't correlate from node: " + parentRegistered );
		}
	}

	@Override
	public <X extends SqmFrom<?, ?>> @Nullable X findFromExposing(String navigableName) {
		// todo (6.0) : atm this checks every from-element every time, the idea being to make sure there
		//  	is only one such element obviously that scales poorly across larger from-clauses.  Another
		//  	(configurable?) option would be to simply pick the first one as a perf optimization

		SqmFrom<?, ?> found = null;
		for ( var entry : sqmFromByPath.entrySet() ) {
			final var fromElement = entry.getValue();
			if ( definesAttribute( fromElement.getReferencedPathSource(), navigableName ) ) {
				if ( found != null ) {
					throw new SemanticException( "Ambiguous unqualified attribute reference '" + navigableName +
							"' (qualify the attribute reference by an identification variable)" );
				}
				found = fromElement;
			}
		}

		if ( found == null ) {
			final var processingState = associatedProcessingState.getParentProcessingState();
			if ( processingState != null ) {
//				QUERY_LOGGER.tracef(
//						"Unable to resolve unqualified attribute [%s] in local from-clause; checking parent ",
//						navigableName
//				);
				found = processingState.getPathRegistry().findFromExposing( navigableName );
			}
		}

//		QUERY_LOGGER.tracef(

View on GitHub (pinned to fad1729dce)

Solutions

  1. The unqualified attribute name matches more than one from-clause element. Qualify the attribute with an identification variable, e.g. alias.attribute.

When it happens

Trigger: An unqualified attribute name matches multiple query roots: Ambiguous unqualified attribute reference '" + navigableName + "' (qualify the attribute reference by an identification variable)

Common situations: HQL with several from-clause roots where a bare attribute name cannot be attributed to one root.


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