Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 22d0af5

Browse files
two improvements to doc for HQL 'order by'
1 parent 4c94ee7 commit 22d0af5

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

‎documentation/src/main/asciidoc/querylanguage/Relational.adoc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,8 @@ Even the identification variable of an entity with a sortable identifier type ma
563563
[NOTE]
564564
====
565565
The JPQL specification requires that every sorted item in the `order by` clause also occur in the `select` clause.
566-
HQL does not enforce this restriction, but applications desiring database portability should be aware that some databases _do_.
566+
HQL does not enforce this restriction, but if you desire cross-database portability, you should be aware that some databases _do_.
567+
And even databases which don't usually enforce this restriction do enforce it for `distinct` queries.
567568
568569
Therefore, you might wish to avoid the use of complex expressions in the sort list.
569570
====
@@ -615,6 +616,12 @@ having year(order.dateTime) > 2000
615616
order by yearlyTotalSold desc, year desc
616617
----
617618

619+
[TIP]
620+
====
621+
If a query doesn't explicitly specify `nulls first` or `nulls last`, then, by default, the precedence of null values depends on the database.
622+
To obtain platform-independent behavior for queries which don't specify `nulls first` or `nulls last`, set the configuration property `hibernate.order_by.default_null_ordering` to `first` or `last`.
623+
====
624+
618625
Queries with an ordered result list may have limits or pagination.
619626

620627
[[limit-offset]]

‎documentation/src/main/asciidoc/userguide/chapters/query/hql/QueryLanguage.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3902,7 +3902,8 @@ Even the identification variable of an entity with a sortable identifier type ma
39023902
[NOTE]
39033903
====
39043904
The JPQL specification requires that every sorted item in the `order by` clause also occur in the `select` clause.
3905-
HQL does not enforce this restriction, but applications desiring database portability should be aware that some databases _do_.
3905+
HQL does not enforce this restriction, but if you desire cross-database portability, you should be aware that some databases _do_.
3906+
And even databases which don't usually enforce this restriction do enforce it for `distinct` queries.
39063907

39073908
Therefore, you might wish to avoid the use of complex expressions in the sort list.
39083909
====

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /