0
votes

I'm trying to insert data into a table called users. I'm only passing a value for the name field and this exception pops up.

I'm not even passing any Timestamp in the parameter.

The data still gets inserted into the database even if this happens. Why though?

Here is the error I'm getting: [RuntimeException: TypeDoesNotMatch(Cannot convert 2014-10-21 17:41:41.982: class java.sql.Timestamp to Long for column ColumnName(users.joined,Some(joined)))]

Here's the code:

DB.withConnection { implicit conn =>
  val id: Option[Long] =
    SQL("insert into pinglet.users (name) VALUES ('jel124')")
      .executeInsert()
    outString += id.getOrElse("nuffin'")
}

Info

joined is a field of data type timestamp with time zone.

My scala version is 2.11.1

java version is 1.8.0_25

My postgres jdbc driver is 9.3-1102-jdbc41

1

1 Answers

0
votes

I guess the pk returned by INSERT is a timestamp, and you ask it to be parsed as Option[Long.