{"record":{"id":"470b7a684d212483","repo":"hibernate/hibernate-orm","slug":"unique-constraint-name-on-table-table-ha","errorCode":null,"errorMessage":"Unique constraint '${name}' on table '${table}' has no columns","messagePattern":"Unique constraint '(.+?)' on table '(.+?)' has no columns","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/IndexBinder.java","lineNumber":139,"sourceCode":"\t\t\t\t\t+ \" on table '\" + table.getName() + \"' has no columns\" );\n\t\t}\n\t\tfinal Selectable[] columns = new Selectable[size];\n\t\tfor ( int index = 0; index < size; index++ ) {\n\t\t\tfinal String columnName = columnNames[index];\n\t\t\tif ( isEmpty( columnName ) ) {\n\t\t\t\tthrow new AnnotationException( \"Index\"\n\t\t\t\t\t\t+ ( isEmpty( name ) ? \"\" : \" '\" + name + \"'\" )\n\t\t\t\t\t\t+ \" on table '\" + table.getName() + \"' has an empty column name\" );\n\t\t\t}\n\t\t\tcolumns[index] = selectable( table, columnName );\n\t\t}\n\t\treturn columns;\n\t}\n\n\tprivate Column[] columns(Table table, String name, final String[] columnNames) {\n\t\tfinal int size = columnNames.length;\n\t\tif ( size == 0 ) {\n\t\t\tthrow new AnnotationException( \"Unique constraint\"\n\t\t\t\t\t+ ( isEmpty( name ) ? \"\" : \" '\" + name + \"'\" )\n\t\t\t\t\t+ \" on table '\" + table.getName() + \"' has no columns\" );\n\t\t}\n\t\tfinal Column[] columns = new Column[size];\n\t\tfor ( int index = 0; index < size; index++ ) {\n\t\t\tfinal String columnName = columnNames[index];\n\t\t\tif ( isEmpty( columnName ) ) {\n\t\t\t\tthrow new AnnotationException( \"Unique constraint\"\n\t\t\t\t\t\t+ ( isEmpty( name ) ? \"\" : \" '\" + name + \"'\" )\n\t\t\t\t\t\t+ \" on table '\" + table.getName() + \"' has an empty column name\" );\n\t\t\t}\n\t\t\tcolumns[index] = column( table, columnName );\n\t\t}\n\t\treturn columns;\n\t}\n\n\tprivate void createIndexOrUniqueKey(\n\t\t\tTable table,","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/IndexBinder.java#L121-L157","documentation":"Error \"Unique constraint '${name}' on table '${table}' has no columns\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An @Index or unique constraint declaration has no columns or an empty/unknown column name.","commonSituations":"@Table indexes/uniqueConstraints with an empty columnList or referencing columns that do not exist on the table.","solutions":["Add at least one column to the unique constraint column list."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}