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)。

posted @ 2014-05-30 16:21  Lblogs  阅读(668)  评论(1编辑  收藏  举报