How to use ORDERBY with findAll () function in Play

Is there a way I can use ORDERBY with findAll () in the Play Framework?

+7
source share
2 answers

Model.findAll() is a shortcut that immediately retrieves the results, which is equivalent to Model.all().fetch() .

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

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

+16
source

This line seemed to work for me (game 2.1)

 find.where().orderBy("fieldname desc").findList() 
+6
source

All Articles