{"record":{"id":"33680bca03180b89","repo":"hibernate/hibernate-orm","slug":"attempt-to-resolve-jdbc-metadata-failed-to-find-co","errorCode":null,"errorMessage":"Attempt to resolve JDBC metadata failed to find columns for index [%s]","messagePattern":"Attempt to resolve JDBC metadata failed to find columns for index \\[(.+?)\\]","errorType":"exception","errorClass":"SchemaManagementException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/IndexInformationImpl.java","lineNumber":57,"sourceCode":"\t\treturn new Builder( indexIdentifier );\n\t}\n\n\tpublic static class Builder {\n\t\tprivate final Identifier indexIdentifier;\n\t\tprivate final List<ColumnInformation> columnList = new ArrayList<>();\n\n\t\tpublic Builder(Identifier indexIdentifier) {\n\t\t\tthis.indexIdentifier = indexIdentifier;\n\t\t}\n\n\t\tpublic Builder addColumn(ColumnInformation columnInformation) {\n\t\t\tcolumnList.add( columnInformation );\n\t\t\treturn this;\n\t\t}\n\n\t\tpublic IndexInformationImpl build() {\n\t\t\tif ( columnList.isEmpty() ) {\n\t\t\t\tthrow new SchemaManagementException(\n\t\t\t\t\t\t\"Attempt to resolve JDBC metadata failed to find columns for index [\" + indexIdentifier.getText() + \"]\"\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn new IndexInformationImpl( indexIdentifier, Collections.unmodifiableList( columnList ) );\n\t\t}\n\t}\n}\n","sourceCodeStart":39,"sourceCodeEnd":65,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/IndexInformationImpl.java#L39-L65","documentation":"SchemaManagementException from IndexInformationImpl.Builder.build(): while extracting index metadata, the driver reported an index by name but zero ColumnInformation rows could be associated with it, so IndexInformation cannot be constructed. Like the foreign-key variant, it signals incomplete or unmappable JDBC metadata from getIndexInfo() rather than a broken mapping.","triggerScenarios":"Schema extraction (validate/update) iterates DatabaseMetaData.getIndexInfo() rows grouped by index name; Builder.addColumn is called per usable row and build() throws when a named index group ends with an empty column list. Triggered by indexes whose COLUMN_NAME the driver reports as null (expression and partial indexes on PostgreSQL, Oracle domain/bitmap indexes, SQL Server columnstore/statistics rows) or by driver versions that emit index headers without column rows.","commonSituations":"hbm2ddl validate hitting a hand-created expression index like CREATE INDEX ... ON t (lower(email)); Oracle bitmap or domain indexes with legacy drivers; DB upgraded but driver kept old; CI validating against a database with DBA-tuned special indexes.","solutions":["Upgrade the JDBC driver to the version matching your database server.","Recreate the reported index as a plain b-tree column index that JDBC metadata can describe (columns, not expressions).","Drop the @Index/@Table(indexes=...) declaration for indexes Hibernate cannot model, and manage them purely via migrations.","Move schema management to Flyway/Liquibase so validation does not depend on JDBC index metadata."],"exampleFix":"-- before: expression index - JDBC metadata exposes no column for it\nCREATE INDEX idx_user_lower_email ON app_user (lower(email));\n\n-- after: plain column index matches JDBC metadata expectations\nCREATE INDEX idx_user_email ON app_user (email);","handlingStrategy":"try-catch","validationCode":"// Before hbm2ddl, report indexes whose JDBC rows expose no column\ntry (Connection c = dataSource.getConnection();\n     ResultSet rs = c.getMetaData().getIndexInfo(null, null, \"app_user\", false, false)) {\n    while (rs.next()) {\n        if (rs.getString(\"INDEX_NAME\") != null && rs.getString(\"COLUMN_NAME\") == null) {\n            System.err.println(\"Index \" + rs.getString(\"INDEX_NAME\") + \" reports no column - review before hbm2ddl\");\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    new SchemaValidator().validate(metadata, serviceRegistry);\n} catch (SchemaManagementException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"failed to find columns for index\")) {\n        // treat as driver/index-definition problem: check for expression/partial/domain indexes on the named index\n    }\n    throw e;\n}","preventionTips":["Avoid expression, partial, bitmap, and domain indexes on tables covered by hbm2ddl validation","Keep the JDBC driver current with the database version","Manage special indexes through migrations, outside the Hibernate-validated model"],"tags":["hibernate","schema-management","jdbc-metadata","index","hbm2ddl"],"backgroundTag":"jdbc-metadata-extraction","analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}