{"record":{"id":"1c774a37b958720e","repo":"hibernate/hibernate-orm","slug":"was-unable-to-locate-subclass-table-s-in-subcl","errorCode":null,"errorMessage":"Was unable to locate subclass table [%s] in 'subclassTableNameClosure'","messagePattern":"Was unable to locate subclass table \\[(.+?)\\] in 'subclassTableNameClosure'","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java","lineNumber":631,"sourceCode":"\t\t\tif ( subclassTableNameClosure[i].equals( tableName ) ) {\n\t\t\t\tfound = true;\n\t\t\t\tfinal int index = i - coreTableSpan;\n\t\t\t\tif ( index < 0 || index >= mapping.length ) {\n\t\t\t\t\tthrow new IllegalStateException(\n\t\t\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\t\t\"Encountered 'subclass table index' [%s] was outside expected range ( [%s] < i < [%s] )\",\n\t\t\t\t\t\t\t\t\tindex,\n\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\tmapping.length\n\t\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tmapping[index] = toStringArray( classNames );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ( !found ) {\n\t\t\tthrow new IllegalStateException(\n\t\t\t\t\tString.format(\n\t\t\t\t\t\t\t\"Was unable to locate subclass table [%s] in 'subclassTableNameClosure'\",\n\t\t\t\t\t\t\ttableName\n\t\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\t@Override\n\tpublic boolean needsDiscriminator() {\n\t\treturn forceDiscriminator;\n\t}\n\n\t@Override\n\tpublic boolean isNullableTable(int j) {\n\t\treturn isNullableTable[j];\n\t}\n","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java#L613-L649","documentation":"Same construction-time pass as the subclass table index check: after scanning subclassTableNameClosure for a table owned by a subclass, no entry matched, so Hibernate cannot associate subclass class names with that table. It means the table referenced by the subclass mapping is not part of the subclass table-name closure - the names disagree (quoting or case) or the closure was built without that join. SessionFactory boot fails with an IllegalStateException naming the table.","triggerScenarios":"JOINED hierarchy where a subclass join table is quoted (backticks) in one mapping location and unquoted in another; globally-quoted identifiers (hibernate.globally_quoted_identifiers) interacting with explicit quotes; a physical naming strategy producing a different physical name than the @Table value; duplicate subclass mappings referencing the same table.","commonSituations":"Mixed hbm.xml and annotation mappings with inconsistent quoting; case-sensitive identifier databases (PostgreSQL, Oracle); migration from Hibernate 5 hbm join mappings; ImplicitNamingStrategy/PhysicalNamingStrategy overrides renamed tables after closure construction.","solutions":["Use one exact, consistently-quoted table name everywhere the table appears in the hierarchy","Check hibernate.globally_quoted_identifiers and your physical naming strategy for name rewrites","Upgrade Hibernate to the latest patch release (closure-building fixes landed across 6.x/7.x)","Simplify the hierarchy - drop joins temporarily - to isolate which mapping fragment introduces the unknown table"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use one exact, consistently-quoted spelling for each table name everywhere in the hierarchy","Audit hibernate.globally_quoted_identifiers and custom naming strategies when joins stop resolving","Cover every inheritance mapping with a SessionFactory smoke test in CI"],"tags":["hibernate","orm","joined-inheritance","mapping","quoted-identifiers"],"backgroundTag":"joined-inheritance-table-mapping-error","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}