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 Brett Meyer
parent 18561b8dfb
commit e83691501f
1 changed files with 19 additions and 0 deletions

View File

@ -301,8 +301,16 @@ public class HSQLDialect extends Dialect {
};
}
// 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;
}
@ -669,4 +677,15 @@ public class HSQLDialect extends Dialect {
public boolean supportsTupleDistinctCounts() {
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 ";
}
}