The code for the nullSafeGet method of the flexible EnumUserType (Martin
Kersten) should be null-safe, which it is not now. It should be:
public Object nullSafeGet(ResultSet resultSet, String[] names,
Object owner)
throws SQLException {
Object identifier = type.get(resultSet, names[0]);
if (identifier == null) {
return null;
}
else {
try {
return valueOfMethod.invoke(null, new Object[] { identifier });
}
catch (Exception e) {
throw new HibernateException("Exception while invoking "
+ "valueOf method '" + valueOfMethod + "' on enum class '"
+ enumClass + "'.", e);
}
}
} |