From 3f34271a57c3ea95cea7f784e729c41ebeb6cb56 Mon Sep 17 00:00:00 2001 From: brmeyer Date: Thu, 6 Sep 2012 12:48:49 -0400 Subject: [PATCH] HHH-7577 Dialect's supportsNotNullUnique not working when false --- hibernate-core/src/main/java/org/hibernate/mapping/Table.java | 4 ++-- .../main/java/org/hibernate/metamodel/relational/Table.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Table.java b/hibernate-core/src/main/java/org/hibernate/mapping/Table.java index 4c2e96903d..be8131bf1d 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Table.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Table.java @@ -394,7 +394,7 @@ public class Table implements RelationalModel, Serializable { boolean useUniqueConstraint = column.isUnique() && dialect.supportsUnique() && - ( !column.isNullable() || dialect.supportsNotNullUnique() ); + ( column.isNullable() || dialect.supportsNotNullUnique() ); if ( useUniqueConstraint ) { alter.append( " unique" ); } @@ -495,7 +495,7 @@ public class Table implements RelationalModel, Serializable { } boolean useUniqueConstraint = col.isUnique() && - ( !col.isNullable() || dialect.supportsNotNullUnique() ); + ( col.isNullable() || dialect.supportsNotNullUnique() ); if ( useUniqueConstraint ) { if ( dialect.supportsUnique() ) { buf.append( " unique" ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Table.java b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Table.java index 1aa57c9669..4d7562a776 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Table.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/relational/Table.java @@ -200,7 +200,7 @@ public class Table extends AbstractTableSpecification implements Exportable { } boolean useUniqueConstraint = col.isUnique() && - ( !col.isNullable() || dialect.supportsNotNullUnique() ); + ( col.isNullable() || dialect.supportsNotNullUnique() ); if ( useUniqueConstraint ) { if ( dialect.supportsUnique() ) { buf.append( " unique" );