title: Mapping column types Slick 3.1.1
body: <p>I am new to Slick and having a really hard time getting mapping of java.sql.date/time/timestamp mapped into jodatime.</p>
  
  <pre><code>trait ColumnTypeMappings {
  
    val profile: JdbcProfile
    import profile.api._
  
    val localTimeFormatter = DateTimeFormat.forPattern("HH:mm:ss")
    val javaTimeFormatter = new SimpleDateFormat("HH:mm:ss")
  
    implicit val myDateColumnType = MappedColumnType.base[LocalDate, Date](
      ld =&gt; new        java.sql.Date(ld.toDateTimeAtStartOfDay(DateTimeZone.UTC).getMillis),
      d  =&gt; new LocalDateTime(d.getTime).toLocalDate
    )
  
    implicit val myTimeColumnType = MappedColumnType.base[LocalTime, Time](
      lt =&gt; new java.sql.Time(javaTimeFormatter.parse(lt.toString(localTimeFormatter)).getTime),
      t  =&gt; new LocalTime(t.getTime)
    )
  
    implicit val myTimestampColumnType = MappedColumnType.base[DateTime, Timestamp](
      dt =&gt; new java.sql.Timestamp(dt.getMillis),
      ts =&gt; new DateTime(ts.getTime, DateTimeZone.UTC)
    )
  
  }
  </code></pre>
  
  <p>In the auto generated Tables.scala I include the mapping like this:</p>
  
  <pre><code>trait Tables extends ColumnTypeMappings {
    val profile: slick.driver.JdbcDriver
    import profile.api._
    import scala.language.implicitConversions
    // + rest of the auto generated code by slick codegen
  }
  </code></pre>
  
  <p>And to wrap it all up I use this like this:</p>
  
  <pre><code>object TestTables extends Tables {
    val profile = slick.driver.MySQLDriver
  }
  
  import Tables._
  import profile.api._
  
  val db = Database.forURL("url", "user", "password", driver = "com.mysql.jdbc.Driver")
  val q = Company.filter(_.companyid === 1).map(._name)
  val action = q.result
  val future = db.run(action)
  val result = Await.result(future, Duration.Inf)
  </code></pre>
  
  <p>I get an NullPointerException on: implicit val myDateColumnType.... when running this. I've verified that this last block of code works if I remove the mapping.</p>