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

BeanProcessor not returning nanoseconds

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5
    • 1.6
    • None

    Description

      We are calling an SP to retrieve a timestamp from the DB but the mapping of the nano seconds is not being done correctly. Only milliseconds are being returned although the SP is returning the nano seconds.
      After debugging through the apache db utils, we found that in the class BeanProcessor (method callSetter), the setting of timestamp is not being done properly:

      if ("java.sql.Timestamp".equals(targetType)) {
           value = new java.sql.Timestamp(((java.util.Date) value).getTime());
       }
      

      We have modified the codes as follows so as to get the nano seconds:

      if ("java.sql.Timestamp".equals(targetType))
      {
       int nanos = ((Timestamp) value).getNanos(); 
      value = new java.sql.Timestamp(((Timestamp) value).getTime());
       ((Timestamp) value).setNanos(nanos); 
      } 
      

      Can you please provide a fix as soon as possible. (v1.6 would be great)

      Attachments

        1. vcs-diff8964305076305734485.patch
          4 kB
          Daniele Cremonini

        Activity

          People

            britter Benedikt Ritter
            feysal Feysal Rujbally
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: