Using hibernate 1.7.2 i experienced an exception that
TYPES.BOOLEAN (16) is not recognized by dbunit 2.1
snapshot.
Copying BooleanDataType for Boolean2DataType and just
setting:
Boolean2DataType()
{
super("BOOLEAN", Types.BOOLEAN, Boolean.class,
false);
}
and registering Boolean2DataType in DataType like
BooleanDataType, the problem was fixed.
Logged In: YES
user_id=215483
There's a slightly more pleasant way of dealing with this,
IMO. Instead of adding a new type, change BooleanDataType's
constructor to:
BooleanDataType(String name, int sqlType)
{
super(name, sqlType, Boolean.class, false);
}
and change DataType.java to have:
public static final DataType BOOLEAN = new BooleanDataType(
"BOOLEAN", Types.BOOLEAN);
public static final DataType BIT = new BooleanDataType(
"BIT", Types.BIT);
This reduces code duplication, and fits in with how other
data types are implemented.
Logged In: YES
user_id=34142
Originator: NO
Any progress on this? Seems like an easy fix?
Logged In: YES
user_id=1892030
Originator: NO
We had a very similar problem to berni 123, and jskeet and we fixed it in almost exactly the same way. The problem was caused in dbunit 2.2 and hsqldb 1.8.0.7. hsqldb used boolean not BIT.
Create a New class in datatypes package to represent true sql boolean
---------------
public class RealSqlBooleanDataType extends BooleanDataType {
super("BOOLEAN", Types.BOOLEAN);
}
}
In existing BooleanDataType add a constructor for subclasses to call up to AbstractDataType
so they can overide default BIT behaviour which is the cause of the bug
--------------------
public class BooleanDataType extends AbstractDataType
{
......
/**
* Called from subclasses to pass though its values to super (as in skeet)
*/
BooleanDataType(final String databaseDataType, final int dataTypesValue)
{
super(databaseDataType, dataTypesValue, Boolean.class, false);
}
Make 2 changes to this class to enable type checking iteration to pick up new RealSqlBooleanDataType()
public abstract class DataType
public static final DataType REAL_SQL_BOOLEAN = new RealSqlBooleanDataType();
Add variable REAL_SQL_BOOLEAN to TYPES [] so that it gets iterated when checking sql column types in
public static DataType forSqlType(int sqlType) throws DataTypeException
in class DataType
A FIX IN NEXT VERSION WOULD BE MUCH APPRECIATED! we have had to resort to our own build of dbunit with code fix as a work around.
Logged In: YES
user_id=1892030
Originator: NO
Found in Dbunit 2.2. There is no Software Version field for this issue. Please note that we had the latest source and binary versions of dbunit (2.2) when we verified that this issue was present.
Logged In: YES
user_id=1803108
Originator: NO
I committed the fix for the upcoming 2.3 release and updated the unit tests. (svn rev. 783/trunk)
Regards,
mat