Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-16815 (
https://hibernate.atlassian.net/browse/HHH-16815?atlOrigin=eyJpIjoiYzMzNz...
)
Re: add methods to SelectionQuery to add order by items (
https://hibernate.atlassian.net/browse/HHH-16815?atlOrigin=eyJpIjoiYzMzNz...
)
For those who weren’t in love with putting ascending() and descending() directly on Query
, and wanted a separate object representing a sort order which can be passed around, how
about the following “compromise” API which has nice features of both options:
* Introduce an Order object which is some sort of linked list.
* Add only Query.setOrder(Order)}}to {{Query.
The most naive usage would look like:
session.createSelectionQuery( "from Book" )
.setOrder(Order.asc(Book_.title).desc(Book_.isbn))
.getResultList();
Or, for sorting by column index:
session.createSelectionQuery( "select isbn, title from Book" )
.setOrder(Order.asc(0).desc(1))
.getResultList();
The Order API itself could be quite flexible, accommodating stuff like:
session.createSelectionQuery( "from Book" )
.setOrder(Order.by(Book_.title, SortOrder.ASCENDING).by(Book_.isbn,
SortOrder.DESCENDING))
.getResultList();
along with other stuff we haven’t even thought of yet.
Thus, Order would occupy a very similar role in the architecture that EntityGraph occupies
for fetching.
(
https://hibernate.atlassian.net/browse/HHH-16815#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16815#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100227- sha1:9e449c4 )