Since you are using scalas option class use None instead of null:
val log: Log = new Log(NotAssigned, "user", None, "DFD", None)
Question
I'm trying to create a case class and object as below
case class Log (
id: Pk[Long],
module: String,
reference: Option[Long],
remarks: String,
at: Option[Date] )
object Log {
val simple = {
get[Pk[Long]]("id") ~
get[String]("module") ~
get[Option[Long]]("reference") ~
get[String]("remarks") ~
get[Option[Date]]("at") map {
case id ~ module ~ reference ~ remarks ~ at => Log(id, module, reference, remarks, at)
}
}
How to I create an object of Log with null values for reference & at, and save it?
val log: Log = new Log(NotAssigned, "user", null, "DFD", null)
Could you please guide on what I'm doing wrong? Also, at (db column) has a default value to now [using mysql]
Solution
Since you are using scalas option class use None instead of null:
val log: Log = new Log(NotAssigned, "user", None, "DFD", None)