skinny-framework / skinny-framework

:monorail: "Scala on Rails" - A full-stack web app framework for rapid development in Scala

Home Page:https://skinny-framework.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Saving dates goes wrong in Member Demo

zoosky opened this issue · comments

Member Data:
Name: Three
Brithday: 3,3,3

Saves:

ID 7
Three
0003-02-28

Expected: 0003-03-03

Skinny Version:

val appOrganization = "org.skinny-framework"
val appName = "skinny-blank-app"
val appVersion = "0.1.0-SNAPSHOT"

val skinnyVersion = "2.5.0"
val theScalaVersion = "2.12.3"
val jettyVersion = "9.3.20.v20170531"

BTW Skinny looks nice 👍

Thanks for trying Skinny ORM! The problem you encountered is a known java.sql.Date's limitation.

A milliseconds value represents the number of milliseconds that have passed since January 1, 1970 00:00:00.000 GMT.

Skinny ORM (and its basis, ScalikeJDBC) sends a LocalDate value as a java.sql.Date value to JDBC drivers.

If you need to handle the cases you pointed, you need to have your own ParameterBinder for the type.
https://github.com/scalikejdbc/scalikejdbc/blob/526ac64e1e7142fd7e8a8504298c13fbd4e2f9ba/scalikejdbc-core/src/main/scala/scalikejdbc/StatementExecutor.scala#L82

Thx for the explanation and the pointers.