Uploaded image for project: 'InsightEdge Platform'
  1. GS-13634

SQLQuery with comparison operators for types that equals and compareTo behave differently is wrongly optimized

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects versions: None
    • Fix versions: None
    • Labels:
      None
    • Platform:
      All
    • SalesForce Case ID:
      12042
    • Sprint:
    • Product:
      XAP
    • Edition:
      Open Source

      Description

      An error happens when a Comparable class implements the method compareTo() incompatible with equals(). As in BigDecimal: the method BigDecimal.equals() takes into account a number of leading zeros, whereas the method BigDecimal.compareTo() ignores leading zeros.

      So if we have an object with 2.2 BigDecimal property
      query:SQLQuery<TestDomainObject> query = new SQLQuery<>(TestDomainObject.class, "bgValue <= ? and bgValue >= ?", new BigDecimal("2.20"), new BigDecimal("2.20"))
      will return nothing since it will intersect the range and use equal instead of compareTo == 0.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ester Ester Atzmon
              Participants of an issue:
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: