hibernate date类型插入数据库时精度只到日期没有时间


由hibernate 的逆向工具从数据库表生成的*.hbm.xml ,对于数据库的date类型生成如下:        <property name = "crttime" type= "date">             <column name = "CRTTIME" length = "7"  />         property >   程序中的类型: private Date crttime ; 但通过程序setCrttime(new Date()) 的时候,插入到数据库的日期只到天,没有小时以后的数据。   网上查了一下,有的说可以修改type类型为 java.util.Date, 但实验发现hibernate不能识别此类型,修改为timestamp则可以。   如下是最终修改:         <property name ="crttime" type="timestamp">             <column name ="CRTTIME"   />         property >   我把length = "7" 也去掉了