This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-17. For the latest, interactive version please visit https://mariadb.com/kb/.

millisecond part is trimmed away when saving Java Date obj by hibernate

Hi,

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 Vladislav Vaintroub 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.

http://bazaar.launchpad.net/~maria-captains/maria/connectorj-5.1.5-micro/

(don't be confused by "5.1.5", it is a wrong label, repo is a based on 5.1.15)

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.