{"record":{"id":"e1a5f8e8fc340c1d","repo":"hibernate/hibernate-orm","slug":"tablereferences-cannot-be-resolved-relative-to-der","errorCode":null,"errorMessage":"TableReferences cannot be resolved relative to DerivedTableReferences - '%s' : %s","messagePattern":"TableReferences cannot be resolved relative to DerivedTableReferences - '(.+?)' : (.+?)","errorType":"exception","errorClass":"UnknownTableReferenceException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/sql/ast/tree/from/DerivedTableReference.java","lineNumber":48,"sourceCode":"\n\t@Override\n\tpublic String getTableId() {\n\t\treturn null;\n\t}\n\n\tpublic List<String> getColumnNames() {\n\t\treturn columnNames;\n\t}\n\n\tpublic boolean isLateral() {\n\t\treturn lateral;\n\t}\n\n\t@Override\n\tpublic TableReference resolveTableReference(\n\t\t\tNavigablePath navigablePath,\n\t\t\tString tableExpression) {\n\t\tthrow new UnknownTableReferenceException(\n\t\t\t\ttableExpression,\n\t\t\t\t\"TableReferences cannot be resolved relative to DerivedTableReferences - '\" + tableExpression + \"' : \" + navigablePath\n\t\t);\n\t}\n\n\t@Override\n\tpublic TableReference resolveTableReference(\n\t\t\tNavigablePath navigablePath,\n\t\t\tValuedModelPart modelPart,\n\t\t\tString tableExpression) {\n\t\tthrow new UnknownTableReferenceException(\n\t\t\t\ttableExpression,\n\t\t\t\t\"TableReferences cannot be resolved relative to DerivedTableReferences - '\" + tableExpression + \"' : \" + navigablePath\n\t\t);\n\t}\n\n\t@Override\n\tpublic TableReference getTableReference(","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/from/DerivedTableReference.java#L30-L66","documentation":"Error \"TableReferences cannot be resolved relative to DerivedTableReferences - '%s' : %s\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A table reference is resolved relative to a derived (subquery) table reference, which is not supported.","commonSituations":"Qualifying columns with the alias of a derived table (subquery in the FROM clause) in a way that requires resolving its inner table references.","solutions":["Table references cannot be resolved relative to a derived table (subquery in the FROM clause). Restructure the query so the column is qualified by a real table or expose the column from the derived table's select list.","If the reference is generated internally by Hibernate, report it as a Hibernate bug."],"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"}