I'm using Anorm 2.5 and the following snippet:
import anorm.SqlParser._
import anorm._
// Not really needed, but to be sure
import anorm.JavaTimeToStatement
import anorm.JavaTimeParameterMetaData
import anorm.JavaTimeColumn
val localDate = java.time.LocalDate.of(2015, 9, 25)
val value = SQL"""SELECT id FROM table WHERE date = $localDate;""".as(get[Long]("id").singleOpt)
yields this error:
found : java.time.LocalDate
[error] required: anorm.ParameterValue
[error] date = $localDate
According to the changelog, anorm 2.5 should actually support java.time.LocalDate conversions. Can someone help? In my opinion the java.time.LocalDate support is not working.
LocalDate
is supported as column, but not as parameter for the packagejava.time
. Until this is fix, a workaround is to use.atStartOfDay
before passing theLocalDate
. – Obstetrics