|
The above described behaviour of BeanProcessor.toBean() can be fixed by changing the implementation to the following:
private void callSetter(Object target, PropertyDescriptor prop, Object value) Method setter = prop.getWriteMethod(); if (setter == null) { return; } Class[] params = setter.getParameterTypes(); } catch (IllegalArgumentException e) {
throw new SQLException(
"Cannot set " + prop.getName() + ": " + e.getMessage());
} catch (IllegalAccessException e) {
throw new SQLException(
"Cannot set " + prop.getName() + ": " + e.getMessage());
} catch (InvocationTargetException e) {
throw new SQLException(
"Cannot set " + prop.getName() + ": " + e.getMessage());
} Any chance of a patch file? Will make it easier if you're in the habit of supplying those sooner rather than later.
'svn diff' can create them, as can the GUI svn tools (I presume). Patch to resolve issue as described in previous comments.
Oops, bad on my part. Your patch for
So this is resolved as a part of r470003. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"The column type can be converted to the property's set method parameter type
with a ResultSet.get* method. If the conversion fails (ie. the property was an
int and the column was a Timestamp) an SQLException is thrown."
So I guess the right behavior in the case you mention would be to throw an
exception.
An alternative would be to try a conversion (long->int) and cast an exception
only if it's not possible (because the value overflows).