Commons DbUtils
  1. Commons DbUtils
  2. DBUTILS-84

BeanProcessor method processColumn should take SQLXML in consideration

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 1.5
    • Labels:
    • Environment:

      Windows 7 + IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Windows 7 x86-32 jvmwi3260sr9-20110216_75791 (JIT enabled, AOT enabled)

      Description

      I was experimenting DbUtils and discovered that if the result set contains a SQLXML column using the BeanProcessor the returned type will be a String and not a java.sql.SQLXML.

      Part of the problem is related with the fact the SQL Server driver returns a String.
      The call to ResultSet.getObject([SQLXML index]) is returning a String instead of the java.sql.SQLXML, but if we call the ResultSet.getSQLXML([SQLXML index]) it works as expected.

      The correction I've made on the DbUtils was to add the following code:

      BeanProcess.java
          protected Object processColumn(ResultSet rs, int index, Class<?> propType)
              throws SQLException {
      
              (...)
              
              } else if (propType.equals(SQLXML.class)) {
              	return rs.getSQLXML(index);
                  
              } else {
                  return rs.getObject(index);
              }
      
      1. BeanProcessor.java
        17 kB
        Tiago Cavaleiro

        Activity

        Tiago Cavaleiro created issue -
        Tiago Cavaleiro made changes -
        Field Original Value New Value
        Attachment BeanProcessor.java [ 12503381 ]
        William R. Speirs made changes -
        Fix Version/s 1.5 [ 12317964 ]
        Description

        I was experimenting DbUtils and discovered that if the result set contains a SQLXML column using the BeanProcessor the returned type will be a String and not a java.sql.SQLXML.

        Part of the problem is related with the fact the SQL Server driver returns a String.
        The call to ResultSet.getObject([SQLXML index]) is returning a String instead of the java.sql.SQLXML, but if we call the ResultSet.getSQLXML([SQLXML index]) it works as expected.


        The correction I've made on the DbUtils was to add the following code:

        {code:title=BeanProcess.java|borderStyle=solid}
            protected Object processColumn(ResultSet rs, int index, Class<?> propType)
                throws SQLException {

                (...)
                
                } else if (propType.equals(SQLXML.class)) {
                 return rs.getSQLXML(index);
                    
                } else {
                    return rs.getObject(index);
                }
        {code}



        I was experimenting DbUtils and discovered that if the result set contains a SQLXML column using the BeanProcessor the returned type will be a String and not a java.sql.SQLXML.

        Part of the problem is related with the fact the SQL Server driver returns a String.
        The call to ResultSet.getObject([SQLXML index]) is returning a String instead of the java.sql.SQLXML, but if we call the ResultSet.getSQLXML([SQLXML index]) it works as expected.


        The correction I've made on the DbUtils was to add the following code:

        {code:title=BeanProcess.java|borderStyle=solid}
            protected Object processColumn(ResultSet rs, int index, Class<?> propType)
                throws SQLException {

                (...)
                
                } else if (propType.equals(SQLXML.class)) {
                 return rs.getSQLXML(index);
                    
                } else {
                    return rs.getObject(index);
                }
        {code}


        Simone Tripodi made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee William R. Speirs [ wspeirs ]
        Resolution Fixed [ 1 ]
        Simone Tripodi made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            William R. Speirs
            Reporter:
            Tiago Cavaleiro
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 5m
              5m
              Remaining:
              Remaining Estimate - 5m
              5m
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development