Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5183

Not able to save data of java.sql.Time data type

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Should
    • Resolution: Fixed
    • Affects Version/s: Core 2.1.0
    • Component/s: None
    • Labels:
      None
    • Complexity:
      Low

      Description

      java mapping for MySql Time is java.sql.Time. It is a wrapper around the Date class. But whenever Time is saved this interceptor is called
      and the if condition candidate instanceof Date holds true
      => it execute the if branch
      where we have DateUtil.truncateToSeconds((Date) candidate)
      in the DateUtil class
      truncateToSeconds(Date date) {
      Instant instant = date.toInstant().truncatedTo(ChronoUnit.SECONDS);
      return Date.from(instant);
      so date.toInstant() is called
      but in Time class toInstant method throws new UnsupportedOperationException();
      so whenever we save Time we are getting this exception

        Attachments

          Activity

            People

            Assignee:
            shruthipitta shruthi pitta [X] (Inactive)
            Reporter:
            shruthipitta shruthi pitta [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day
                1d