hibernate/hibernate-orm · error · AnnotationException

Unique constraint '${name}' on table '${table}' has an empty

Error message

Unique constraint '${name}' on table '${table}' has an empty column name

What it means

Error "Unique constraint '${name}' on table '${table}' has an empty column name" thrown in hibernate/hibernate-orm.

Source

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

						+ " 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,
			String originalKeyName,
			boolean nameExplicit,
			String[] columnNames,
			String[] orderings,
			boolean unique,
			boolean declaredAsIndex,
			String type,
			String using,

View on GitHub (pinned to fad1729dce)

Solutions

  1. Replace the empty column name in the unique constraint with a valid column name.

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/dc6b3997c3a7158f. Report an issue: GitHub.