mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-20 01:55:02 +00:00
[HHH-10640] fix wrong expected statement on DB2
This commit is contained in:
parent
cbdab9d87f
commit
e861182f19
@ -17,6 +17,8 @@
|
|||||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||||
import org.hibernate.boot.spi.MetadataImplementor;
|
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.hbm2ddl.SchemaExport;
|
||||||
import org.hibernate.tool.schema.TargetType;
|
import org.hibernate.tool.schema.TargetType;
|
||||||
|
|
||||||
@ -74,10 +76,16 @@ public void testUniqueConstraintIsCorrectlyGenerated() throws Exception {
|
|||||||
statement.toLowerCase().contains( "alter table element" ),
|
statement.toLowerCase().contains( "alter table element" ),
|
||||||
is( false )
|
is( false )
|
||||||
);
|
);
|
||||||
if ( statement.toLowerCase().startsWith( "alter table category add constraint" )
|
if (ssr.getService(JdbcEnvironment.class).getDialect() instanceof DB2Dialect) {
|
||||||
&& statement.toLowerCase().contains( "unique (code)" ) ) {
|
if (statement.toLowerCase().startsWith("create unique index")
|
||||||
isUniqueConstraintCreated = true;
|
&& statement.toLowerCase().contains("category (code)")) {
|
||||||
|
isUniqueConstraintCreated = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (statement.toLowerCase().startsWith("alter table category add constraint")
|
||||||
|
&& statement.toLowerCase().contains("unique (code)")) {
|
||||||
|
isUniqueConstraintCreated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user