HHH-9038 Fix HSQLDB dialect for non-existing constraints.

This commits relates to https://hibernate.atlassian.net/browse/HHH-7002.
It basically removes the explicit constraints dropping, and uses
cascading instead.

As HSQLDB requires to put CASCADE last, but fortunately accepts IF
EXISTS also before tablename, we just put the IF EXISTS *before* the
tablename, and CASCADE after it. And there you go.
This commit is contained in:
Baptiste Mathus 2013-12-10 11:39:11 +01:00 committed by Guillaume Smet
parent e55c3bbb7e
commit f2b82449da
1 changed files with 19 additions and 0 deletions

View File

@ -313,8 +313,16 @@ public class HSQLDialect extends Dialect {
return hsqldbVersion < 200;
}
// Note : HSQLDB actually supports [IF EXISTS] before AND after the <tablename>
// But as CASCADE has to be AFTER IF EXISTS in case it's after the tablename,
// We put the IF EXISTS before the tablename to be able to add CASCADE after.
@Override
public boolean supportsIfExistsAfterTableName() {
return false;
}
@Override
public boolean supportsIfExistsBeforeTableName() {
return true;
}
@ -684,4 +692,15 @@ public class HSQLDialect extends Dialect {
public boolean supportsNamedParameters(DatabaseMetaData databaseMetaData) throws SQLException {
return false;
}
// Do not drop constraints explicitly, just do this by cascading instead.
@Override
public boolean dropConstraints() {
return false;
}
@Override
public String getCascadeConstraintsString() {
return " CASCADE ";
}
}