Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 73735 invoked from network); 3 Nov 2006 17:05:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Nov 2006 17:05:42 -0000 Received: (qmail 60294 invoked by uid 500); 3 Nov 2006 17:05:50 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 60228 invoked by uid 500); 3 Nov 2006 17:05:49 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 60217 invoked by uid 99); 3 Nov 2006 17:05:49 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Nov 2006 09:05:49 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Nov 2006 09:05:38 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id BF0A97142F0 for ; Fri, 3 Nov 2006 09:05:17 -0800 (PST) Message-ID: <17774835.1162573517780.JavaMail.root@brutus> Date: Fri, 3 Nov 2006 09:05:17 -0800 (PST) From: "Henri Yandell (JIRA)" To: commons-dev@jakarta.apache.org Subject: [jira] Resolved: (DBUTILS-1) [dbutils] BeanListHandler and BeanHandler fail to support java.sql.Date() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ http://issues.apache.org/jira/browse/DBUTILS-1?page=all ] Henri Yandell resolved DBUTILS-1. --------------------------------- Resolution: Fixed svn ci -m "Enabling the bean handlers to support java.sql.Date, Time and Timestamp. #DBUTILS-1. " Sending src/java/org/apache/commons/dbutils/BeanProcessor.java Transmitting file data . Committed revision 470904. > [dbutils] BeanListHandler and BeanHandler fail to support java.sql.Date() > ------------------------------------------------------------------------- > > Key: DBUTILS-1 > URL: http://issues.apache.org/jira/browse/DBUTILS-1 > Project: Commons DbUtils > Issue Type: Bug > Environment: Operating System: Windows 2000 > Platform: PC > Reporter: Xinyi-Huang > Fix For: 1.1 > > Attachments: patch-DBUTILS-1-and-3.txt, Proposed-DBUTILS-1.patch > > > 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()); > } > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org