Closed lukasj closed 11 months ago
@glassfishrobot Commented Reported by oliver.gierke
@glassfishrobot Commented c.beikov said: Also not that this is important for database exchangeability. If I didn't specify nulls first or nulls last every query that uses the order by is non-portable between databases since databases have different defaults.
@glassfishrobot Commented This issue was imported from java.net JIRA JPA_SPEC-76
@andyjefferson Commented Here you go, just specify this BNF,
orderby_clause ::= ORDER BY orderby_item {, orderby_item}* orderby_item ::={ state_field_path_expression | general_identification_variable | result_variable } [ASC | DESC] [NULLS FIRST | NULLS LAST]
"The keywords "NULLS FIRST" or "NULLS LAST" defines where nulls are placed in the ordering of that item. No specification of nulls means that the ordering when the item is null is undefined."
Then you'll have what any sane JPA provider would have implemented years ago. Can't be that controversial can it?
Is there a chance, this get's prioritized for JakartaEE 10? Users of Spring Data JPA and downstream projects have been repeatedly and patiently asked for this for years, and it's a severe limitation compared to accessing other store types.
AFAIU the community can just take over here and provide a specification, API and TCK update. We are willing to implement the JPA Criteria changes for Hibernate to serve as compatible implementation.
If anyone is willing to work on this, Hibernate can serve as a compatible implementation.
How hard would it be to take this on as a new (and ocasional) contributor?
I have proposed a solution in #440.
§4.9 of the specification explictly states:
However, pretty much all of the important JPA providers support a nulls first/nulls last clause. So while it is already possible to define the strategy, it would be cool if one could reliably use it on top of JPA.