millisecond part is trimmed away when saving Java Date obj by hibernate
I recently upgraded my MySQL DB to MariaDB for millisecond support. I can see the millisecond part in my upgraded database. And I tested the millisecond support by inserting a row to a table of my db. It functions well. But when I use hibernate to save a java.util.Date obj into database, millisecond part is trimmed and in MariaDB date obj is saved as: 2012-02-13 18:40:55.000. Do I need to set up something to activate millisecond support? Or I need to config hibernate for millisecond support?
Thanks a lot!
Answer Answered by wlad in this comment.
In case official Connector/J still does not support fractional seconds, and you're comfortable with compiling connector from source, we have a repository based on Connector/J 5.1.15 with microsecond support.
(don't be confused by "5.1.5", it is a wrong label, repo is a based on 5.1.15)
- ↑ Date and Time Functions ↑
- Microseconds in MariaDB
- Date and Time Units
- DATE FUNCTION
- TIME function
- TIMESTAMP FUNCTION