svenkubiak
svenkubiak

Reputation: 672

How to use ORDERBY with findAll() in Play

is there any way i can use ORDERBY with findAll() in Play Framework?

Upvotes: 8

Views: 8043

Answers (2)

Robb Hoff
Robb Hoff

Reputation: 1920

This line seemed to work for me (play 2.1)

find.where().orderBy("fieldname desc").findList()

Upvotes: 10

mike
mike

Reputation: 4433

Model.findAll() is a shortcut which fetches the results right away, it's equivalent to Model.all().fetch().

I think the best way to specify order is by using a JPQL query like this:

Model.find("order by fieldName desc").fetch();

Upvotes: 17

Related Questions