{"record":{"id":"7d406ba037b5bf14","repo":"hibernate/hibernate-orm","slug":"ambiguous-unqualified-attribute-reference-nav","errorCode":null,"errorMessage":"Ambiguous unqualified attribute reference '\" + navigableName + \"' (qualify the attribute reference by an identification variable)","messagePattern":"Ambiguous unqualified attribute reference '\" \\+ navigableName \\+ \"' \\(qualify the attribute reference by an identification variable\\)","errorType":"exception","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SqmPathRegistryImpl.java","lineNumber":264,"sourceCode":"\t\t\treturn selectQuery.correlate( join );\n\t\t}\n\t\telse {\n\t\t\tthrow new UnsupportedOperationException( \"Can't correlate from node: \" + parentRegistered );\n\t\t}\n\t}\n\n\t@Override\n\tpublic <X extends SqmFrom<?, ?>> @Nullable X findFromExposing(String navigableName) {\n\t\t// todo (6.0) : atm this checks every from-element every time, the idea being to make sure there\n\t\t//  \tis only one such element obviously that scales poorly across larger from-clauses.  Another\n\t\t//  \t(configurable?) option would be to simply pick the first one as a perf optimization\n\n\t\tSqmFrom<?, ?> found = null;\n\t\tfor ( var entry : sqmFromByPath.entrySet() ) {\n\t\t\tfinal var fromElement = entry.getValue();\n\t\t\tif ( definesAttribute( fromElement.getReferencedPathSource(), navigableName ) ) {\n\t\t\t\tif ( found != null ) {\n\t\t\t\t\tthrow new SemanticException( \"Ambiguous unqualified attribute reference '\" + navigableName +\n\t\t\t\t\t\t\t\"' (qualify the attribute reference by an identification variable)\" );\n\t\t\t\t}\n\t\t\t\tfound = fromElement;\n\t\t\t}\n\t\t}\n\n\t\tif ( found == null ) {\n\t\t\tfinal var processingState = associatedProcessingState.getParentProcessingState();\n\t\t\tif ( processingState != null ) {\n//\t\t\t\tQUERY_LOGGER.tracef(\n//\t\t\t\t\t\t\"Unable to resolve unqualified attribute [%s] in local from-clause; checking parent \",\n//\t\t\t\t\t\tnavigableName\n//\t\t\t\t);\n\t\t\t\tfound = processingState.getPathRegistry().findFromExposing( navigableName );\n\t\t\t}\n\t\t}\n\n//\t\tQUERY_LOGGER.tracef(","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SqmPathRegistryImpl.java#L246-L282","documentation":"Error \"Ambiguous unqualified attribute reference '\" + navigableName + \"' (qualify the attribute reference by an identification variable)\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An unqualified attribute name matches multiple query roots: Ambiguous unqualified attribute reference '\" + navigableName + \"' (qualify the attribute reference by an identification variable)","commonSituations":"HQL with several from-clause roots where a bare attribute name cannot be attributed to one root.","solutions":["The unqualified attribute name matches more than one from-clause element. Qualify the attribute with an identification variable, e.g. alias.attribute."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}