There is a change in default behavior of SchemaUpdate - now SchemaUpdate ignores unique constraints on columns.
Is this expected behavior?
In detail:
Before version 4.1.10 SchemaUpdate created unique constraints for column (indirectly, in Table.sqlAlterStrings):
Code:
boolean useUniqueConstraint = column.isUnique() &&
dialect.supportsUnique() &&
( column.isNullable() || dialect.supportsNotNullUnique() );
if ( useUniqueConstraint ) {
alter.append( " unique" );
}
And this code in version 4.1.10:
Code:
if ( column.isUnique() ) {
UniqueKey uk = getOrCreateUniqueKey(
column.getQuotedName( dialect ) + '_' );
uk.addColumn( column );
alter.append( dialect.getUniqueDelegate()
.applyUniqueToColumn( column ) );
}
As it was said in HHH-7797: "The default delegate creates unique constraints in separate "alter table" statements."
But Configuration.generateSchemaUpdateScript ignores
table.getUniqueKeyIterator() That's why unique constraint aren't created.