{"record":{"id":"49b90029e705751f","repo":"hibernate/hibernate-orm","slug":"could-not-locate-table-information-for-s","errorCode":null,"errorMessage":"Could not locate table information for %s","messagePattern":"Could not locate table information for (.+?)","errorType":"exception","errorClass":"SchemaExtractionException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/AbstractInformationExtractorImpl.java","lineNumber":1013,"sourceCode":"\t\t\t\t\t\t\"Error while reading primary key meta data for namespace \"\n\t\t\t\t\t\t+ new Namespace.Name( catalog, schema ) );\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate TableInformation getTableInformation(\n\t\t\t@Nullable String catalogName,\n\t\t\t@Nullable String schemaName,\n\t\t\t@Nullable String tableName) {\n\t\tfinal var qualifiedTableName = new QualifiedTableName(\n\t\t\t\ttoIdentifier( catalogName ),\n\t\t\t\ttoIdentifier( schemaName ),\n\t\t\t\ttoIdentifier( tableName )\n\t\t);\n\t\tfinal var tableInformation =\n\t\t\t\textractionContext.getDatabaseObjectAccess().locateTableInformation( qualifiedTableName );\n\t\tif ( tableInformation == null ) {\n\t\t\tthrow new SchemaExtractionException( \"Could not locate table information for \" + qualifiedTableName );\n\t\t}\n\t\treturn tableInformation;\n\t}\n\n\tprotected NameSpacePrimaryKeysInformation extractNameSpacePrimaryKeysInformation(ResultSet resultSet)\n\t\t\tthrows SQLException {\n\t\tfinal var primaryKeysInformation = new NameSpacePrimaryKeysInformation( getIdentifierHelper() );\n\n\t\twhile ( resultSet.next() ) {\n\t\t\tfinal String currentTableName = resultSet.getString( getResultSetPrimaryKeyTableLabel() );\n\t\t\tfinal String currentPkName = resultSet.getString( getResultSetPrimaryKeyNameLabel() );\n\t\t\tfinal Identifier currentPrimaryKeyIdentifier =\n\t\t\t\t\tcurrentPkName == null ? null : toIdentifier( currentPkName );\n\t\t\tfinal var tableInformation = getTableInformation(\n\t\t\t\t\tresultSet.getString( getResultSetPrimaryKeyCatalogLabel() ),\n\t\t\t\t\tresultSet.getString( getResultSetPrimaryKeySchemaLabel() ),\n\t\t\t\t\tcurrentTableName\n\t\t\t);","sourceCodeStart":995,"sourceCodeEnd":1031,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/AbstractInformationExtractorImpl.java#L995-L1031","documentation":"During namespace-wide primary-key extraction, every resultset row must map back to a table the extraction context already knows: locateTableInformation(qualifiedTableName). A row whose catalog/schema/table identifiers resolve to no extracted table means the PK resultset references an object the table-extraction phase never saw, so Hibernate throws SchemaExtractionException naming the qualified name instead of guessing.","triggerScenarios":"The bulk PK query reports identifiers that match no extracted table: case-normalizing drivers returning uppercase catalogs/schemas where table extraction recorded different casing; a table created or dropped between the two extraction queries; catalog/schema filters that differ between the table and PK queries.","commonSituations":"Oracle/SQL Server-style uppercase metadata versus Hibernate's stored identifier forms; quoted-identifier mappings on case-preserving databases; concurrent DDL during schema validation in CI pipelines.","solutions":["Align identifier case and quoting: set hibernate.default_catalog / hibernate.default_schema to the exact stored form (often uppercase on Oracle) and quote only truly quoted objects.","Restrict extraction to the single intended catalog/schema so rows from unrelated namespaces cannot leak in.","Re-run when the schema is quiescent — concurrent DDL between the table and PK extraction phases causes exactly this mismatch."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"String storedSchema = connection.getMetaData().getSchemaTerm() != null\n        ? connection.getSchema() : null;\n// ensure configured default schema/catalog matches the stored form Hibernate will see\nif (storedSchema != null && !storedSchema.equals(configuredDefaultSchema)) {\n    props.put(\"hibernate.default_schema\", storedSchema); // align case before hbm2ddl\n}","typeGuard":null,"tryCatchPattern":"try {\n    schemaValidator.validate(metadata, databaseModel);\n} catch (SchemaExtractionException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Could not locate table information\")) {\n        // identifier case/catalog/schema mismatch between PK rows and extracted tables — align and re-run\n    }\n    throw e;\n}","preventionTips":["Set hibernate.default_catalog/default_schema to the database's stored case (often uppercase on Oracle).","Do not run schema validation while migrations/DDL execute concurrently.","Keep quoted-identifier usage consistent between mappings and physical schema."],"tags":["hibernate","schema-extraction","primary-key","identifier-casing","jdbc-metadata"],"backgroundTag":"schema-extraction-table-mismatch","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}