From df6efccd91e8963a5b19ff61130f594c6c911edd Mon Sep 17 00:00:00 2001 From: Martin Simka Date: Thu, 24 Mar 2016 13:35:32 +0100 Subject: [PATCH] [HHH-10640] fix wrong expected statement on DB2 --- .../tableperclass/SchemaCreationTest.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/inheritance/tableperclass/SchemaCreationTest.java b/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/inheritance/tableperclass/SchemaCreationTest.java index b5e48a5140..c65b612f46 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/inheritance/tableperclass/SchemaCreationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/schemaupdate/inheritance/tableperclass/SchemaCreationTest.java @@ -16,6 +16,8 @@ import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.spi.MetadataImplementor; +import org.hibernate.dialect.DB2Dialect; +import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; import org.hibernate.tool.hbm2ddl.SchemaExport; import org.junit.After; @@ -72,10 +74,16 @@ public class SchemaCreationTest { statement.toLowerCase().contains( "alter table element" ), is( false ) ); - if ( statement.toLowerCase().startsWith( "alter table category add constraint" ) - && statement.toLowerCase().contains( "unique (code)" ) ) { - isUniqueConstraintCreated = true; - + if (ssr.getService(JdbcEnvironment.class).getDialect() instanceof DB2Dialect) { + if (statement.toLowerCase().startsWith("create unique index") + && statement.toLowerCase().contains("category (code)")) { + isUniqueConstraintCreated = true; + } + } else { + if (statement.toLowerCase().startsWith("alter table category add constraint") + && statement.toLowerCase().contains("unique (code)")) { + isUniqueConstraintCreated = true; + } } }