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:
parent
e55c3bbb7e
commit
f2b82449da
|
@ -313,8 +313,16 @@ public class HSQLDialect extends Dialect {
|
||||||
return hsqldbVersion < 200;
|
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
|
@Override
|
||||||
public boolean supportsIfExistsAfterTableName() {
|
public boolean supportsIfExistsAfterTableName() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsIfExistsBeforeTableName() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,4 +692,15 @@ public class HSQLDialect extends Dialect {
|
||||||
public boolean supportsNamedParameters(DatabaseMetaData databaseMetaData) throws SQLException {
|
public boolean supportsNamedParameters(DatabaseMetaData databaseMetaData) throws SQLException {
|
||||||
return false;
|
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 ";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue