You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Dmitry Mamonov (JIRA)" <ji...@apache.org> on 2009/10/07 11:37:31 UTC

[jira] Commented: (DBUTILS-24) [dbutils] Modify BasicRowProcessor to use the column label

    [ https://issues.apache.org/jira/browse/DBUTILS-24?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12762964#action_12762964 ] 

Dmitry Mamonov commented on DBUTILS-24:
---------------------------------------

I'm using mysql-connector-java-5.1.7-bin.jar driver. Here is my problem:
SELECT parent.name as parentName, child.name as childName
FROM peoples parent
LEFT JOIN peoples child on child.parentId = parent.id
WHERE ....;

This way getColumnName() method returns "name" for 1st column, and (sic!) name for 2nd column,
so I cant reach values from first colum at all using  MapListHandler for example.

I'm fixing it manually changing getColumnName() to getColumnLabel() in BasicRowProcessor class, 
but it looks not so cute.

> [dbutils] Modify BasicRowProcessor to use the column label
> ----------------------------------------------------------
>
>                 Key: DBUTILS-24
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-24
>             Project: Commons DbUtils
>          Issue Type: Improvement
>         Environment: Operating System: other
> Platform: Other
>            Reporter: gene
>            Priority: Minor
>
> BasicRowProcessor.mapColumnsToProperties currently uses 'getColumnName' to 
> determine what property to set on the bean. It would be more flexible if it 
> used 'getColumnLabel'. This would allow the developer to specify the property 
> name as an alias to a column in the sql query.
> For example 'select last_name lastname, first_name firstname from employee'. 
> Note that 'getColumnLabel' will defaults to the column name if no alias is 
> specified in the query.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.