hibernate/hibernate-orm · error · AnnotationException

Index '${name}' on table '${table}' has no columns

Error message

Index '${name}' on table '${table}' has no columns

What it means

Error "Index '${name}' on table '${table}' has no columns" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/IndexBinder.java:119

//					"Table '" + table.getName() + "' has no column named '" + columnName
//							+ "' matching the column specified in '@UniqueConstraint'"
//			);
//		}
	}

	private Column createColumn(String logicalName) {
		final Database database = getDatabase();
		final String physicalName =
				getPhysicalNamingStrategy()
						.toPhysicalColumnName( database.toIdentifier( logicalName ), database.getJdbcEnvironment() )
						.render( getDialect() );
		return new Column( physicalName );
	}

	private Selectable[] selectables(Table table, String name, String[] columnNames) {
		final int size = columnNames.length;
		if ( size == 0 ) {
			throw new AnnotationException( "Index"
					+ ( isEmpty( name ) ? "" : " '" + name + "'" )
					+ " on table '" + table.getName() + "' has no columns" );
		}
		final Selectable[] columns = new Selectable[size];
		for ( int index = 0; index < size; index++ ) {
			final String columnName = columnNames[index];
			if ( isEmpty( columnName ) ) {
				throw new AnnotationException( "Index"
						+ ( isEmpty( name ) ? "" : " '" + name + "'" )
						+ " on table '" + table.getName() + "' has an empty column name" );
			}
			columns[index] = selectable( table, columnName );
		}
		return columns;
	}

	private Column[] columns(Table table, String name, final String[] columnNames) {
		final int size = columnNames.length;

View on GitHub (pinned to fad1729dce)

Solutions

  1. Add at least one column to the @Index column list.

When it happens

Trigger: An @Index or unique constraint declaration has no columns or an empty/unknown column name.

Common situations: @Table indexes/uniqueConstraints with an empty columnList or referencing columns that do not exist on the table.


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