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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.1.6
    • core-libs
    • 1.1.6
    • sparc
    • solaris_7



      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)
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: