Skip to content

Commit e89d707

Browse files
committed
HHH-18621 attempt to not dupe identity column clause when using @column(columnDefinition)
This is just a best effort, not robust at all
1 parent 8baa2f1 commit e89d707

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

hibernate-core/src/main/java/org/hibernate/tool/schema/internal/ColumnDefinitions.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ private static void appendColumnDefinition(
197197
}
198198
final String identityColumnString = dialect.getIdentityColumnSupport()
199199
.getIdentityColumnString( column.getSqlTypeCode( metadata ) );
200-
definition.append( ' ' ).append( identityColumnString );
200+
// the custom columnDefinition might have already included the
201+
// identity column generation clause, so try not to add it twice
202+
if ( !definition.toString().toLowerCase(Locale.ROOT).contains( identityColumnString ) ) {
203+
definition.append( ' ' ).append( identityColumnString );
204+
}
201205
}
202206
else {
203207
final String columnType = column.getSqlType( metadata );

0 commit comments

Comments
 (0)