hibernate/hibernate-orm · error · AnnotationException

Unique constraint '${name}' on table '${table}' has no colum

Error message

Unique constraint '${name}' on table '${table}' has no columns

What it means

Error "Unique constraint '${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:139

					+ " 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;
		if ( size == 0 ) {
			throw new AnnotationException( "Unique constraint"
					+ ( isEmpty( name ) ? "" : " '" + name + "'" )
					+ " on table '" + table.getName() + "' has no columns" );
		}
		final Column[] columns = new Column[size];
		for ( int index = 0; index < size; index++ ) {
			final String columnName = columnNames[index];
			if ( isEmpty( columnName ) ) {
				throw new AnnotationException( "Unique constraint"
						+ ( isEmpty( name ) ? "" : " '" + name + "'" )
						+ " on table '" + table.getName() + "' has an empty column name" );
			}
			columns[index] = column( table, columnName );
		}
		return columns;
	}

	private void createIndexOrUniqueKey(
			Table table,

View on GitHub (pinned to fad1729dce)

Solutions

  1. Add at least one column to the unique constraint 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/470b7a684d212483. Report an issue: GitHub.