I have a Play Framework application with ebeans.To synchronise between the main system and an offline system I use an addDate field to identify unique records.
This works perfect while developing and initial testing (development with jdbc:h2:mem:play;MODE=MYSQL) and testing with a limited dataset.
But in production, with concurrent users I discovered that in the MySQL database milliseconds are not stored. I have the fields created as datetime(6), but a query like:
SELECT UNIX_TIMESTAMP(add_date) FROM `user` WHERE 1
returns:
1499722493.000000
1499772800.000000
1499777225.000000
1499790922.000000
1499875868.000000
1499954855.000000
1499977124.000000
1499981148.000000
1499986822.000000
(ps. just selecting the add_date field in MySQL return 2015-12-17 16:15:50.000000, showing the precision is there)
So milliseconds are not stored. In Java I use the normal Date class, so they are in there (and so in the H2 men test database).
protected Date addDate;
How can I have the milliseconds stored in the Database with my current configuration without, hopefully, having to rewrite too much code?
[Edit:]
I am using MySQL on Debian: Ver 14.14 Distrib 5.6.35
sbt.version=0.13.11
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.16")
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "3.0.2")
mysql-connector-java % 5.1.43