hibernate 插入date值到postgresql,丢失时分秒

  用hibernate插入java.util.Date数据时发现 时分秒 会丢失。如 2014-05-30 15:59:16.921 在postgresql数据库中显示2014-05-30 00:00:00.0。

  后来查了一下是因为Model类的 annotation 中的写成 @Temporal(TemporalType.DATE)  ,正确应该要写成  @Temporal(TemporalType.TIMESTAMP)。

原文地址:https://www.cnblogs.com/LBlogs/p/hibernate_insert_date_to_postgresql_timestamp.html