I have a Play form that looks like this:
val form = Form( tuple(
/* 5 more fields */
"dueDate" -> optional(date)
) )
I'm trying to insert "dueDate"
into an object in Slick.
newAuditForm.bindFromRequest.fold(
errors => BadRequest(views.html.error(form)),
success => {
Database.forDataSource(DB.getDataSource()) withSession {
Things.forInsert.insert Thing(
(success._6).asInstanceOf[Option[java.sql.Date]]
)
}
}
)
where Slick only deals with java.sql.Date
, and Play only deals with java.util.Date
(?) in the Form
object.
Using asInstanceOf
returns:
ClassCastException: java.util.Date cannot be cast to java.sql.Date
There's got to be a way for me to write a rule for this cast to be possible ... would I need to write a new pattern matching rule?