Enhancement #136
Make Order.ASC/ORDER.DESC sortProperty specific
| Status: | Closed | Start: | 10/23/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assigned to: | % Done: | 100% |
||
| Category: | Core DAO | Spent time: | 3.00 hours | |
| Target version: | 1.1 |
Description
I think it should be possible to produce JPQL queries like this:select x from User x order by x.firstname ASC, x.lastname DESC
In version 0.7.0 QueryUtils.applySorting always append the sort.getOrder().getJpaValue() as last part of the ORDER BY fragment, so IMHO it's not possible to sort in different directions for multiple columns. I think this will produce some interface changes as well.
Maybe the signature of
1 QueryUtils.applySorting(String query, Sort sort) could be changed to 1 QueryUtils.applySorting(String query, Set<Sort> sort).
Of course this requires some interface changes in higher level classes, too. :S
I just started learning JPA/JPQL but I think this will improve Hades a lot before releasing a 1.0.0 version.
This doc gives me the idea: http://download.oracle.com/docs/cd/E11035_01/kodo41/full/html/ejb3_langref.html#ejb3_langref_orderby
Related issues
| related to Hades - Task #160: Remove deprecations introduced for handling multiple sort parameters | Closed | 11/11/2009 |
Associated revisions
- references #136 - improved
Sortto allow defining order for each property independently if necessary
History
Updated by Oliver Gierke 9 months ago
- Target version changed from 1.0 to 1.1
Hey Joachim,
thanks for the hint. I totally agree with your request. Unfortunately we're currently already in the release process of Version 1.0. We think the following way will allow smooth introduction of the feature without breaking backwards compatibility abruptly:
- We'll intodruce an implementation based on varargs at the public API level with 1.1 to maintain backwards compatibility.
- We'll introduce an implementation with a more neat collection based public API in 2.0.
Let me know what you think.
Olle
Updated by Joachim Uhrlaß 9 months ago
Hi,
oh I didn't realize that 1.0.0 is coming so soon, so the way you suggest seems reasonable.
I like the idea of the collection based API in future versions because I found the varargs a little bit unwieldy.
For my demo/test/sandbox project I will patch this feature locally.
Whats the preferred way of participating in your project?
Maybe I can send you the patch?
Achim
Updated by Oliver Gierke 9 months ago
Joachim Uhrlaß wrote:
Whats the preferred way of participating in your project? Maybe I can send you the patch?
We internally work with Git, so the preferred way is to make a Git clone of the SVN repository, apply your intended changes and just send in the Git repository. This maybe sound as little tedious but makes merging a lot easier.
In case you don't want to get into the hassle of Git, an SVN patch would be okay, too.
To make things easier I'd please you to use the Eclipse formatting style linked here: Development guidelines
Updated by Joachim Uhrlaß 9 months ago
I know git so I will do it this way.
I am an IntelliJ user, but as there is a plugin that supports Eclipse formatting descriptions, this shouldn't be a problem.
Updated by Oliver Gierke 9 months ago
- Status changed from New to In progress
Updated by Oliver Gierke 9 months ago
- Status changed from In progress to Fixed
Updated by Oliver Gierke 8 months ago
- Status changed from Fixed to Closed