hibernate/hibernate-orm · error · SchemaManagementException

Attempt to resolve JDBC metadata failed to find columns for

Error message

Attempt to resolve JDBC metadata failed to find columns for index [%s]

What it means

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.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/IndexInformationImpl.java:57

		return new Builder( indexIdentifier );
	}

	public static class Builder {
		private final Identifier indexIdentifier;
		private final List<ColumnInformation> columnList = new ArrayList<>();

		public Builder(Identifier indexIdentifier) {
			this.indexIdentifier = indexIdentifier;
		}

		public Builder addColumn(ColumnInformation columnInformation) {
			columnList.add( columnInformation );
			return this;
		}

		public IndexInformationImpl build() {
			if ( columnList.isEmpty() ) {
				throw new SchemaManagementException(
						"Attempt to resolve JDBC metadata failed to find columns for index [" + indexIdentifier.getText() + "]"
				);
			}
			return new IndexInformationImpl( indexIdentifier, Collections.unmodifiableList( columnList ) );
		}
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Upgrade the JDBC driver to the version matching your database server.
  2. Recreate the reported index as a plain b-tree column index that JDBC metadata can describe (columns, not expressions).
  3. Drop the @Index/@Table(indexes=...) declaration for indexes Hibernate cannot model, and manage them purely via migrations.
  4. Move schema management to Flyway/Liquibase so validation does not depend on JDBC index metadata.

Example fix

-- before: expression index - JDBC metadata exposes no column for it
CREATE INDEX idx_user_lower_email ON app_user (lower(email));

-- after: plain column index matches JDBC metadata expectations
CREATE INDEX idx_user_email ON app_user (email);
Defensive patterns

Strategy: try-catch

Validate before calling

// Before hbm2ddl, report indexes whose JDBC rows expose no column
try (Connection c = dataSource.getConnection();
     ResultSet rs = c.getMetaData().getIndexInfo(null, null, "app_user", false, false)) {
    while (rs.next()) {
        if (rs.getString("INDEX_NAME") != null && rs.getString("COLUMN_NAME") == null) {
            System.err.println("Index " + rs.getString("INDEX_NAME") + " reports no column - review before hbm2ddl");
        }
    }
}

Try / catch

try {
    new SchemaValidator().validate(metadata, serviceRegistry);
} catch (SchemaManagementException e) {
    if (e.getMessage() != null && e.getMessage().contains("failed to find columns for index")) {
        // treat as driver/index-definition problem: check for expression/partial/domain indexes on the named index
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/33680bca03180b89. Report an issue: GitHub.