Commons DbUtils
  1. Commons DbUtils
  2. DBUTILS-57

BeanProcessor not able to map an alias column from a HSQLDB query to the any bean properties

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3
    • Labels:
      None
    • Environment:

      hsqldb-1.9.0-rc4 memory mode
      DBUtils 1.2

      Description

      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); }


      ...

      1. BeanProcessorTest.patch
        2 kB
        Julien Aymé
      2. BeanProcessor.patch
        0.7 kB
        Julien Aymé

        Activity

          People

          • Assignee:
            Unassigned
            Reporter:
            Wynand
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development