Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4673420

java.sql.Time and java.sql.Date need their own compareTo

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.1.6
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Introduced In Build:
      1.1.6
    • Introduced In Version:
    • CPU:
      sparc
    • OS:
      solaris_7

      Description



      Name: ks84122 Date: 04/23/2002


      java.sql.Time and java.sql.Date both extend from java.util.Date.
      java.util.Date has a compareTo method, that compares the long value.

      However, java.sql.Time/java.sql.Date should really be comparing the
      time/date components of the long value.

      Unfortunately, overriding the compareTo() will break compatibility with previous releases. However, there needs to be a way to compare sql
      date and time values.

      One of the solutions might be addition of new methods, comparing
      time and date respectively.

      ###@###.### 2002-04-23

      Original Description from Borland:

      java.sql.Time and java.sql.Date both extend from java.util.Date.
      java.util.Date has a compareTo method, that compares the long value.

      However a compareTo for java.sql.Time should ignore any date component of the long value such that the range is: [0.00.00-23.59.59].

      A compareTo for java.sql.Date should ignore any time component of the long value.

      Perhaps both classes should provide an integer number which can be used for the above comparisons. This number could then be used for persistence/serialization.
      (Review ID: 145493)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ksoshals Kirill Soshalskiy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: