Uploaded image for project: 'Commons DbUtils'
  1. Commons DbUtils
  2. DBUTILS-84

BeanProcessor method processColumn should take SQLXML in consideration

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.4
    • 1.5
    • 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);
              }
      

      Attachments

        1. BeanProcessor.java
          17 kB
          Tiago Cavaleiro

        Activity

          People

            wspeirs Bill Speirs
            tcavaleiro 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