diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/UniqueKey.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/UniqueKey.java index 339ba1d20e..82e536dda1 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/UniqueKey.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/UniqueKey.java @@ -48,16 +48,14 @@ public class UniqueKey extends AbstractConstraint implements Constraint { @Override public String[] sqlCreateStrings(Dialect dialect) { - return new String[] { - dialect.getUniqueDelegate().applyUniquesOnAlter( this ) - }; + String s = dialect.getUniqueDelegate().applyUniquesOnAlter(this); + return (s == null || s.length() == 0) ? new String[0] : new String[]{s}; } @Override public String[] sqlDropStrings(Dialect dialect) { - return new String[] { - dialect.getUniqueDelegate().dropUniquesOnAlter( this ) - }; + String s = dialect.getUniqueDelegate().dropUniquesOnAlter(this); + return (s == null || s.length() == 0) ? new String[0] : new String[]{s}; } @Override