{"record":{"id":"2fb7f391fb3db35a","repo":"hibernate/hibernate-orm","slug":"duplicate-identification-variable-s-in-join-c","errorCode":null,"errorMessage":"Duplicate identification variable '%s' in 'join' clause [%s%s]","messagePattern":"Duplicate identification variable '(.+?)' in 'join' clause \\[(.+?)(.+?)\\]","errorType":"exception","errorClass":"AliasCollisionException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SqmPathRegistryImpl.java","lineNumber":151,"sourceCode":"\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\tLocale.ENGLISH,\n\t\t\t\t\t\t\t\t\"Duplicate identification variable '%s' in 'from' clause [%s%s]\",\n\t\t\t\t\t\t\t\talias,\n\t\t\t\t\t\t\t\tfromPath( previousFrom, true ),\n\t\t\t\t\t\t\t\tfromPath( sqmFrom, false )\n\t\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tpublic <E> void replace(SqmEntityJoin<?,E> sqmJoin, SqmRoot<E> sqmRoot) {\n\t\tfinal String alias = sqmJoin.getExplicitAlias();\n\t\tif ( alias != null ) {\n\t\t\tfinal var previousFrom = sqmFromByAlias.put( handleAliasCaseSensitivity( alias ), sqmJoin );\n\t\t\tif ( previousFrom != null && !( previousFrom instanceof SqmRoot ) ) {\n\t\t\t\tthrow new AliasCollisionException(\n\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\tLocale.ENGLISH,\n\t\t\t\t\t\t\t\t\"Duplicate identification variable '%s' in 'join' clause [%s%s]\",\n\t\t\t\t\t\t\t\talias,\n\t\t\t\t\t\t\t\tfromPath( previousFrom, true ),\n\t\t\t\t\t\t\t\tfromPath( sqmJoin, false )\n\t\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tfinal var navigablePath = sqmJoin.getNavigablePath();\n\n\t\tfinal var previousFromByPath = sqmFromByPath.put( navigablePath, sqmJoin );\n\t\tif ( previousFromByPath != null && !( previousFromByPath instanceof SqmRoot ) ) {\n\t\t\t// this should never happen\n\t\t\tthrow new ParsingException(\n\t\t\t\t\tString.format(","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SqmPathRegistryImpl.java#L133-L169","documentation":"Error \"Duplicate identification variable '%s' in 'join' clause [%s%s]\" thrown in hibernate/hibernate-orm.","triggerScenarios":"The same alias/identification variable is declared twice: Duplicate identification variable '<value>' in 'join' clause [<value><value>]","commonSituations":"HQL queries reusing an alias in the from/join clauses or a duplicate result alias in the select clause.","solutions":["The join alias duplicates an existing identification variable. Choose a different alias for the join."],"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"}