[HHH-10640] fix wrong expected statement on DB2

This commit is contained in:
Martin Simka 2016-03-24 13:35:32 +01:00 committed by Vlad Mihalcea
parent 971855188e
commit df6efccd91
1 changed files with 12 additions and 4 deletions

View File

@ -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;
}
}
}