This is a simple situation but for some reason orderBy
for me hasn't worked.
I have a very simple model class;
case class Sale(price: Int, name: String) {
@Id
var id: Long = 0
@Formats.DateTime(pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ")
var saleDate: DateTime = new DateTime()
}
and the companion object;
object Sale {
def find = new Finder[String, Sale](classOf[String], classOf[Sale])
}
Then I'm trying to fetch the list of all sale entries and order them using the saleDate
value;
Sale.find
.where
... // some conditions
.orderBy("saleDate desc")
.findMap
It seems pretty simple and straightforward to me, but it doesn't seem to work. Does anyone know what might the reason be?