You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Niall Pemberton (JIRA)" <ji...@apache.org> on 2009/08/05 01:40:14 UTC
[jira] Resolved: (BEANUTILS-344) Method createDynaProperty of
JDBCDynaClass should first look for column label instead of column name in
ResultSetMetadata object..
[ https://issues.apache.org/jira/browse/BEANUTILS-344?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Niall Pemberton resolved BEANUTILS-344.
---------------------------------------
Resolution: Fixed
Fix Version/s: 1.8.1
Assignee: Niall Pemberton
Thanks for the pacth, I have applied a slightly modified version, since I don't want to adversly affect people who are happy with the existing behaviour. There is now an option to configure to use the label (call setUseColumnLabel(true).
http://svn.apache.org/viewvc?view=rev&revision=801021
> 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
> Assignee: Niall Pemberton
> Fix For: 1.8.1
>
> 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.