{"record":{"id":"b73cda690f8a56b9","repo":"hibernate/hibernate-orm","slug":"could-not-resolve-table-reference-s-relative-to","errorCode":null,"errorMessage":"Could not resolve table reference `%s` relative to TableGroup `%s` related with NavigablePath `%s`","messagePattern":"Could not resolve table reference `(.+?)` relative to TableGroup `(.+?)` related with NavigablePath `(.+?)`","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/BasicEntityIdentifierMappingImpl.java","lineNumber":266,"sourceCode":"\t\t\tTableGroup tableGroup,\n\t\t\tFetchParent fetchParent,\n\t\t\tDomainResultCreationState creationState) {\n\t\tfinal var expressionResolver = creationState.getSqlAstCreationState().getSqlExpressionResolver();\n\t\tfinal var rootTableReference = rootTableReference( navigablePath, tableGroup );\n\t\treturn expressionResolver.resolveSqlSelection(\n\t\t\t\texpressionResolver.resolveSqlExpression( rootTableReference, this ),\n\t\t\t\tidType.getJdbcJavaType(),\n\t\t\t\tfetchParent,\n\t\t\t\tsessionFactory.getTypeConfiguration()\n\t\t);\n\t}\n\n\tprivate TableReference rootTableReference(NavigablePath navigablePath, TableGroup tableGroup) {\n\t\ttry {\n\t\t\treturn tableGroup.resolveTableReference( navigablePath, rootTable );\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new IllegalStateException(\n\t\t\t\t\tString.format(\n\t\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\t\"Could not resolve table reference `%s` relative to TableGroup `%s` related with NavigablePath `%s`\",\n\t\t\t\t\t\t\trootTable,\n\t\t\t\t\t\t\ttableGroup,\n\t\t\t\t\t\t\tnavigablePath\n\t\t\t\t\t),\n\t\t\t\t\te\n\t\t\t);\n\t\t}\n\t}\n\n\t@Override\n\tpublic String getContainingTableExpression() {\n\t\treturn rootTable;\n\t}\n\n\t@Override","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/BasicEntityIdentifierMappingImpl.java#L248-L284","documentation":"Error \"Could not resolve table reference `%s` relative to TableGroup `%s` related with NavigablePath `%s`\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown when resolving a table reference for an entity identifier relative to a table group fails because the named table is not part of that group.","commonSituations":"See trigger scenarios.","solutions":["Verify the table reference name used in the mapping/query matches the entity's table name or a known alias within the current table group."],"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"}