No implicit Ordering defined for scala.slick.lifted.ColumnOrdered[Long]

scala, slick-2.0

Solution

you have to sort first and then call `.list()`:

tasks.sortBy(_.id.desc).list()

When calling `list()` you are executing the invoker and that's too late to add the sorting on the sql level, of course you can always sort the collection you get back using the list `sortBy` method.

Problem

I'm using slick 2.0 via play plugin and the following is my table mapping ``` class Tasks(tag: Tag) extends Table[Task](tag, "Tasks"){ def id = column[Option[Long]]("id", O.PrimaryKey, O.AutoInc) def txt = column[String]("txt") def done = column[Boolean]("done") def * = (id, txt, done) <> (Task.tupled, Task.unapply) } ``` Then, I created TableQuery object like this `val tasks = TableQuery[Tasks]` I used `tasks.list` to get `List[Task]` which returns correctly but when I want to sort the result by using `tasks.list.sortBy(_.id.get.desc)` I got this error instead No implicit Ordering defined for scala.slick.lifted.ColumnOrdered[Long]. Any idea?

Original source