Implicit ParameterBinderFactory[org.joda.time.LocalDateTime] for the parameter type

Viewed 98

I brought up the scalikejdbc version and got an error like this:

[error] Implicit ParameterBinderFactory[org.joda.time.LocalDateTime] for the parameter type org.joda.time.LocalDateTime is missing. [error] You need to define ParameterBinderFactory for the type or use AsIsParameterBinder.

  def toUpdaters: Seq[(SQLSyntax, ParameterBinder)] = {
    val ses = SeasonProjection.column
    Seq(
      start.map(ses.start -> _) //<- here

How can I solve the problem?

I have not found any examples

1 Answers

You can check out the documentation at http://scalikejdbc.org/documentation/operations.html, section Using joda-time library.

You need to add a library to allow scalikejdbc to work with Joda:

libraryDependencies += "org.scalikejdbc" %% "scalikejdbc-joda-time" % "3.5.0"

Then use appropriate imports in your code like:

// If you need ParameterBinderFactory for joda-time classes
import scalikejdbc.jodatime.JodaParameterBinderFactory._
// If you need TypeBinder for joda-time classes
import scalikejdbc.jodatime.JodaTypeBinder._

That being said, you might want to get rid of Joda in favour of java.time which is nowadays standard for date/time representations and is most of the time supported out-of-the-box by libraries.

Related