From eadb0fec8f4301a83e438e3066ab92756216e3af Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Wed, 4 Nov 2015 16:16:11 -0600 Subject: [PATCH] HHH-10203 - Overriden UniqueDelegate.getTableCreationUniqueConstraintsFragment not called anymore in SchemaExport --- .../hibernate/tool/schema/internal/StandardTableExporter.java | 2 ++ .../java/org/hibernate/test/hbm/uk/UniqueDelegateTest.java | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardTableExporter.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardTableExporter.java index c336e70822..8adbd1dcc1 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardTableExporter.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardTableExporter.java @@ -135,6 +135,8 @@ public class StandardTableExporter implements Exporter { .append( table.getPrimaryKey().sqlConstraintString( dialect ) ); } + buf.append( dialect.getUniqueDelegate().getTableCreationUniqueConstraintsFragment( table ) ); + applyTableCheck( table, buf ); buf.append( ')' ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/hbm/uk/UniqueDelegateTest.java b/hibernate-core/src/test/java/org/hibernate/test/hbm/uk/UniqueDelegateTest.java index 13bc7d9287..73436ec5d2 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/hbm/uk/UniqueDelegateTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/hbm/uk/UniqueDelegateTest.java @@ -72,7 +72,7 @@ public class UniqueDelegateTest extends BaseUnitTestCase { assertThat( getAlterTableToAddUniqueKeyCommandCallCount, equalTo( 1 ) ); assertThat( getColumnDefinitionUniquenessFragmentCallCount, equalTo( 1 ) ); - assertThat( getTableCreationUniqueConstraintsFragmentCallCount, equalTo( 0 ) ); + assertThat( getTableCreationUniqueConstraintsFragmentCallCount, equalTo( 1 ) ); final SchemaDropper schemaDropper = ssr.getService( SchemaManagementTool.class ).getSchemaDropper( Collections.emptyMap() ); schemaDropper.doDrop( metadata, false, target ); @@ -80,7 +80,7 @@ public class UniqueDelegateTest extends BaseUnitTestCase { // unique keys are not dropped explicitly assertThat( getAlterTableToAddUniqueKeyCommandCallCount, equalTo( 1 ) ); assertThat( getColumnDefinitionUniquenessFragmentCallCount, equalTo( 1 ) ); - assertThat( getTableCreationUniqueConstraintsFragmentCallCount, equalTo( 0 ) ); + assertThat( getTableCreationUniqueConstraintsFragmentCallCount, equalTo( 1 ) ); } public static class MyDialect extends H2Dialect {