Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slick 2.x filter by mapped column type (java.util.Date)

I'm using java.util.Date in my model case class. Since Slick doesn't support j.u.Date out of the box, I added implicit mapping like so implicit val dateColumnMapper = MappedColumnType.base[Date, SqlDate](d => new SqlDate(d.getTime), d => d) to my Table class.

But now I'm stuck with filtering by date field: proposalsQuery.filter(_.since >= since). I tried different options but always get compilation errors: value >= is not a member of scala.slick.lifted.Column[java.util.Date]

Since, I'm new in Scala/Slick working examples with simple explanation of the problem would be highly appreciated.

Thanks!

like image 450
viator Avatar asked Nov 21 '25 22:11

viator


1 Answers

implicit mapper MUST be available at the place where you write your filter query.

like image 141
viator Avatar answered Nov 23 '25 11:11

viator



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!