History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: TM-239
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Tiago Silveira
Reporter: Tiago Silveira
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Tiny Marbles

Filter.orderBy() API for sorting results

Created: 20/Nov/06 12:08 Central European Time   Updated: 06/Mar/07 17:26 Central European Time
Component/s: Filters and Queries
Affects Version/s: None
Fix Version/s: 0.9.5

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Issue Links:
Cause
This issue causes:
TM-282 Finish refactoring of the CriteriaQue... Major Closed
 
Precedence
This issue must be done before:
MUM-11 Sorting in the list Major Resolved
CMS-67 List all articles: sorting result Major Resolved
CMS-68 List all versions: sorting result Major Resolved
 
Related
This issue relates to:
TM-283 Fail when PType.put() is called using... Critical Resolved
This issue is related with:
TM-306 Coverage tests for sorter elements Major Open


 Description  « Hide
We need to be able to sort results by attribute value. I think an API like this could work:

List<PObject> users = repository.createFilter("User")
   .like("name", "a%")
   .orderBy("name")
   .list();

Maybe a better API would be sortAsc and sortDesc. The following example would sort first by release date, newest first, then by title, alphabetically:

List<PObject> objects = repository.createFilter("Songs")
  .in("tags", "rock")
  .sortDesc("releaseDate")
  .sortAsc("title")
  .list();

Since we are using the Criteria API from Hibernate under the hood, we can transfer the same semantics.

 All   Comments   Work Log   Change History   Version Control   Time Spent      Sort Order:
No work has yet been logged on this issue.