DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=38963>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=38963 Summary: BeanListHandler and BeanHandler fail to support java.sql.Date() Product: Commons Version: 1.1.0 Platform: PC OS/Version: Windows 2000 Status: NEW Severity: normal Priority: P2 Component: DbUtils AssignedTo: commons-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] BeanListHandler or BeanHandler fail to support the java.sql.Date type when read from database. I just add some codes to callSetter the method callSetter of BeanProcessor as ---------------------- else if(params[0].getName().equals("java.sql.Date")){ value = (value==null)?null:new java.sql.Date (((java.util.Date)value).getTime()); setter.invoke(target, new Object[] {value}); ---------------------- org.apache.commons.dbutils.BeanProcessor private void callSetter(Object target, PropertyDescriptor prop, Object value) throws SQLException { Method setter = prop.getWriteMethod(); if (setter == null) { return; } Class[] params = setter.getParameterTypes(); try { // Don't call setter if the value object isn't the right type if (this.isCompatibleType(value, params[0])) { setter.invoke(target, new Object[] { value }); }else if(params[0].getName().equals("java.sql.Date")){ value = (value==null)?null:new java.sql.Date (((java.util.Date)value).getTime()); setter.invoke(target, new Object[] {value}); } } 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()); } } -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]