Return-Path: Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: (qmail 35131 invoked from network); 26 Jul 2009 07:02:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 26 Jul 2009 07:02:34 -0000 Received: (qmail 15106 invoked by uid 500); 26 Jul 2009 07:03:39 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 14982 invoked by uid 500); 26 Jul 2009 07:03:38 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 14972 invoked by uid 99); 26 Jul 2009 07:03:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Jul 2009 07:03:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 26 Jul 2009 07:03:36 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A26C7234C051 for ; Sun, 26 Jul 2009 00:03:16 -0700 (PDT) Message-ID: <69303267.1248591796664.JavaMail.jira@brutus> Date: Sun, 26 Jul 2009 00:03:16 -0700 (PDT) From: "Henri Yandell (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (BEANUTILS-344) Method createDynaProperty of JDBCDynaClass should first look for column label instead of column name in ResultSetMetadata object.. In-Reply-To: <688877576.1238915232910.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/BEANUTILS-344?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henri Yandell updated BEANUTILS-344: ------------------------------------ Fix Version/s: (was: 1.8.0-BETA) > Method createDynaProperty of JDBCDynaClass should first look for column label instead of column name in ResultSetMetadata object.. > ---------------------------------------------------------------------------------------------------------------------------------- > > Key: BEANUTILS-344 > URL: https://issues.apache.org/jira/browse/BEANUTILS-344 > Project: Commons BeanUtils > Issue Type: Bug > Components: DynaBean > Affects Versions: 1.8.0-BETA > Reporter: Viral > Attachments: columnName-vs-columnLabel-fix.patch > > Original Estimate: 5h > Remaining Estimate: 5h > > Method *createDynaProperty( ResultSetMetaData metadata, int i)* of class *JDBCDynaClass* should read *column label* instead of *column name* from ResultSetMetadata object. > For example.. > If query is something like *'select user_id as userId, user_name as userName....'* than *columName* variable should have the value *userId* instead of *user_id* > Fix is .. > *Original* > {code:title=JDBCDynaClass.java|borderStyle=solid} > protected DynaProperty createDynaProperty( > ResultSetMetaData metadata, > int i) > throws SQLException { > //This is reading ColumnName but not ColumnLabel which returns value 'user_id' ..not 'userId' > String columnName = metadata.getColumnName(i); > ... > ... > ... > } > {code} > *It should be like following* > {code:title=JDBCDynaClass.java|borderStyle=solid} > protected DynaProperty createDynaProperty( > ResultSetMetaData metadata, > int i) > throws SQLException { > //First read ColumnLabel ..which sould be 'userId' in our case > String columnName = metadata.getColumnLabel(i); > // If ColumnLabel is 'null' or 'empty' read ColumnName... > if(columnName == null || columnName.trim().equals("")) { > columnName = metadata.getColumnName(i); > } > ... > ... > ... > {code} > Let me know if this is not how it suppose to be or I am missing something here. > Thanks, > Viral Patel -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.