After upgrading to Hibernate 5.2 I started seeing exceptions thrown during test initialization of an in-memory database with HSQLDB. With version 4.1 these were reduced to single line errors messages, but in 5.2 the entire stack trace is printed (at the bottom of this description) obscuring test details.
The root cause is that HSQLDB throws an exception if DROP CONSTRAINT is used on a non-existent table even if the 'IF EXISTS' clause is added. HSQL recommends dropping the constraints with the table (per https://sourceforge.net/p/hsqldb/feature-requests/299/).
The HSQLDB syntax for DROP TABLE is:
Note that 'CASCADE' follows the 'IF EXISTS' clause. However, org.hibernate.dialect.Dialect#getDropTableString() and org.hibernate.tool.schema.internal.StandardTableExporter#getSqlDropStrings() only permit the cascade statement returned by Dialect#getCascadeConstraintsString() to be placed between the table name and 'IF EXISTS' clause, not after the IF EXISTS clause.
Thus, HSQL DELETE TABLE <tablename> IF EXISTS CASCADE cannot be supported without creating a custom Dialect that returns a custom Exporter<Table> to override the generation of the DROP TABLE string.
Note that I also believe the default HSQLDialect should return false for dropConstraints() and use the DROP TABLE ... CASCADE option instead.
Here is the stack trace snippet while constructing tables during test initialization:
Please create a pull request with a test case that reproduces your issue and your fix to HSQLDialect.
Ok - I haven't done that before. Can you point me to a reference on setting up an environment to create a test suitable for Hibernate?