We have been using HSQL in-memory along with DBUnit for unit testing lately, and I found an issue using the most recent version of each. Basically, HSQL has added a new data type, BOOLEAN, which replaces BIT. But DBUnit is not updated to support this, and an error is throw when you attempt to insert some BOOLEAN data using DBUnit.
The error looks like this:
WARNING - TABLE.COLUMN data type (16, 'BOOLEAN') not recognized
and will be ignored. See FAQ for more information.
The solution outlined here is straightforward. You need to create a new data type factory that extends the DBUnit class DefaultDataTypeFactory. This new class just handles the SQL type Types.BOOLEAN as a special case. The code follows:
public class HsqlDataTypeFactory
private static final Log log = LogFactory.getLog(HsqlDataTypeFactory.class);
public DataType createDataType(int sqlType, String sqlTypeName)
if (sqlType == Types.BOOLEAN)
return super.createDataType(sqlType, sqlTypeName);
Then, in order to use this data type factory, just set a property on the IDatabaseConnection DBUnit object in your code (here is an example method):