|
This will be tested using MySQL 5.7.
Supporting datetime(fsp) and date(fsp) is complicated because "Inserting a TIME, DATE, or TIMESTAMP value with a fractional seconds part into a column of the same type but having fewer fractional digits results in rounding". [1] The complication is that timestamps stored in Java can have different precision from what gets inserted, making queries that restrict on a timestamp unreliable.
For now, Hibernate will assume datetime(6) for "timestamp" columns. That way, values will not get rounded when inserted.
For now, Hibernate will assume time(0) for "time" columns. because SQL 1992 says the default for <time precision> is 0
When using the new dialect, org.hibernate.dialect.MySQL57InnoDBDialect, any existing datetime columns with default precision (datetime(0)) will need to be altered to be datetime(6).
If support is added for other values for fractional second precision, then Hibernate will need to make changes in SQL generated from HQL to cast timestamp values in restrictions to the proper precision.
[1] http://dev.mysql.com/doc/refman/5.7/en/fractional-seconds.htm
|