Enhancement 113 : ENHANCEMENT: Add support for local sorting of Lists
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
1.2.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
11/05/2009
Updated 
11/05/2009
Type 
Enhancement
 
Attachments 
No attachments

// find orders and their customers
List<Order> list = Ebean.find(Order.class)
.join("customer")
.orderBy("id")
.findList();

// sort by customer name ascending, then by order shipDate
// ... then by the order status descending
Ebean.sort(list, "customer.name, shipDate, status desc");


// sort by customer name descending (with nulls low)
// ... then by the order id
Ebean.sort(list, "customer.name desc nullsLow, id");

 
Rob 11 May 08:01
Fixed in HEAD

Fixed in HEAD.

Rob 12 May 13:49
Also added Filtering...

List list = Ebean.find(MetaQueryStatistic.class).findList();


long nowMinus24Hrs = System.currentTimeMillis() -24*(1000*60*60);

List list2 = Ebean.filter(MetaQueryStatistic.class)
.sort("avgTimeMicros desc")
.gt("executionCount", 0)
.gt("lastQueryTime", nowMinus24Hrs)
.eq("autofetchTuned", true)
.maxRows(10)
.filter(list);

woResponse

Upload a file