[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 cbdab9d87f
commit e861182f19
1 changed files with 12 additions and 4 deletions

View File

@ -17,6 +17,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.hibernate.tool.schema.TargetType;
@ -74,10 +76,16 @@ public class SchemaCreationTest {
statement.toLowerCase().contains( "alter table element" ),
is( false )
);
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;
}
}
}