commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julien Aymé (JIRA) <j...@apache.org>
Subject [jira] Commented: (DBUTILS-57) BeanProcessor not able to map an alias column from a HSQLDB query to the any bean properties
Date Thu, 22 Oct 2009 09:34:59 GMT

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

Julien Aymé commented on DBUTILS-57:
------------------------------------

>From the javadoc description of the getColumnLabel method (see http://java.sun.com/javase/6/docs/api/java/sql/ResultSetMetaData.html#getColumnLabel%28int%29
)

"Gets the designated column's suggested title for use in printouts and displays. The suggested
title is usually specified by the SQL AS clause. If a SQL AS is not specified, the value returned
from getColumnLabel will be the same as the value returned by the getColumnName method."

> BeanProcessor not able to map an alias column from a HSQLDB query to the any bean properties
> --------------------------------------------------------------------------------------------
>
>                 Key: DBUTILS-57
>                 URL: https://issues.apache.org/jira/browse/DBUTILS-57
>             Project: Commons DbUtils
>          Issue Type: Bug
>         Environment: hsqldb-1.9.0-rc4 memory mode
> DBUtils 1.2
>            Reporter: Wynand
>
> Using a query with an alias, hsqldb engine doesn't populate the column name metadata
only the column label metadata.
> In such a case the column isn't mapped.
> To resolve this, the column label should be used in case the column name is not available.
> Here is a snippet from org.apache.commons.dbutils.BeanProcessor.mapColumnsToProperties
line 393 : 
> ...
>        for (int col = 1; col <= cols; col++) {            
>             String columnName = rsmd.getColumnName(col);
>            // columnName is empty, revert to column label
>             if (columnName.length() == 0) {
>                 columnName = rsmd.getColumnLabel(col);
>             }            
>             ...

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


Mime
View raw message