Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-3740

Support for order by nulls first/last

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Trunk
    • Trunk
    • framework
    • None

    Description

      This patch provides the fundamentals to resolve an issue where the sorting of null values were inconsistent (sometimes sorting first and other times sorting last). Specifically, this patch allows one to create an order-by clause via any of the order-by elements of "-myField NULLS LAST" where this text parses out the - (as descending) and the "nulls last".

      Since not all databases support the "nulls" argument on an order by clause (it was introduced as part of the OLAP support specification) , our entity-engine.xml file allows each data source to indicate if it has this support. If the support does not exist and nulls first/last is specified, the sql that is generated uses native sql to simulate the nulls first/last intent. At this time, the derby, postgres, and oracle databases are marked to use the nulls first grammar.

      Right now, if you do not specify "NULLS XXX" in the field-name for the order-by it makes no change whatsever (naturally this assumption could be changed to have a default).

      It should be noted, that my intent here was ultimately to "properly" model the order by into something whose xml representation could look something like ...

      <entity-order-by field-name="fieldName" ascending="true" nulls-first="true" />

      Attachments

        Activity

          People

            jleroux Jacques Le Roux
            bmorley Bob Morley
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: