[ 
https://issues.apache.org/jira/browse/OFBIZ-3740?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12865033#action_12865033
 ] 

Divesh Dutta commented on OFBIZ-3740:
-------------------------------------

HI Bob, 

This patch works as expected for derby, postgres, and oracle databases as you 
have already mentioned. Cant we have some generic solution which supports all 
the databases. Or we can have some conditional code, where we can check which 
datasource is being used, and then generate the sql accordingly. 

Please let me know your views on this. 


> Support for order by nulls first/last
> -------------------------------------
>
>                 Key: OFBIZ-3740
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3740
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: SVN trunk
>            Reporter: Bob Morley
>            Priority: Minor
>             Fix For: SVN trunk
>
>         Attachments: OFBIZ-3740_SupportOrderByNulls.patch
>
>
> 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" />

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to