tag:blogger.com,1999:blog-8474871406958844140.post6716212170059147118..comments2023-12-26T12:46:48.683+00:00Comments on Tech Team Lead News: Migrating from MySQL 5.5 to 5.6.4 to have milliseconds/fractional seconds supportTechiehttp://www.blogger.com/profile/09242813498513889831noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-8474871406958844140.post-1027160767344665832016-02-16T21:17:03.888+00:002016-02-16T21:17:03.888+00:00A nice example of how to implement my own Hibernat...A nice example of how to implement my own Hibernate Dialect.<br /><br />The precision can be parameterized (MySQL supports microseconds precision) by using $p:<br /><br />registerColumnType(java.sql.Types.TIMESTAMP, "timestamp($p)");<br /><br />Example mapping:<br /><br /><br />The inserts above fails due to the limitation of the timestamp data type. The range is '1970-01-01 00:00:01.000000' UTC to '2038-01-19 03:14:07.999999' according to http://dev.mysql.com/doc/refman/5.6/en/date-and-time-type-overview.html <br /><br />Use datetime to support a larger date range ('1000-01-01 00:00:00.000000' to '9999-12-31 23:59:59.999999')<br /><br />registerColumnType(java.sql.Types.TIMESTAMP, "datetime($p)");<br /><br />omwhttps://www.blogger.com/profile/07745733679959572550noreply@blogger.comtag:blogger.com,1999:blog-8474871406958844140.post-52384061861001038062013-10-02T14:23:09.319+01:002013-10-02T14:23:09.319+01:00@Mike Miller: which problem do you exactly mean? T...@Mike Miller: which problem do you exactly mean? The milliseconds or the 1970-01-01 problem? Or both? The insert of 1970-01-01 does happen when you do it on the MySql command line, so that problem can't be Hibernate indeed. The dialect resolver is indeed a Hibernate thing, it is used to determine how it maps Java types on database/DDL types; haven't looked for other possible solutions...Techiehttps://www.blogger.com/profile/09242813498513889831noreply@blogger.comtag:blogger.com,1999:blog-8474871406958844140.post-42692476854003515142013-09-27T16:20:12.733+01:002013-09-27T16:20:12.733+01:00Just found your blog entry while fighting this sam...Just found your blog entry while fighting this same problems. We support MySQL 5.5 but I got a new laptop and decided to try 5.6 and started getting errors for all our datetime fields. We define as 'datetime' not timestamp. <br /><br />Can this be done without changing the dialect resolver? I haven't touched those in the past.<br /><br />I created a straight-forward jdbc prepared statement example and get the same error without Hibernate being involved, which makes me thing it isn't really a Hibernate issue.<br />Mike Millerhttps://www.blogger.com/profile/09697567698545249690noreply@blogger.com