hibernate 运用new Date() 时分秒丢失(使用Annotation 注解)

hibernate 使用new Date() 时分秒丢失(使用Annotation 注解)在使用oracle 10g 时候,数据库字段设置为date

hibernate 使用new Date() 时分秒丢失(使用Annotation 注解)
在使用oracle 10g 时候,数据库字段设置为date类型.用工具
自动生成的Entity

 @Temporal(TemporalType.DATE)    @Column(name="UPDATE_DATE")    public Date getUpdateDate() {        return this.updateDate;    }

修改成如下:
@Temporal(value = TemporalType.TIMESTAMP)      @Column(name="UPDATE_DATE")    public Date getUpdateDate() {        return this.updateDate;    }

这样就可以直接使用 new Date()了
toplMUser.setCreateDate(new Date());this.toplMUserService.update(toplMUser);