首页 > 其他 > 详细

hibernate自动建表设定字段类型为timestamp

时间:2014-02-17 17:35:13      阅读:374      评论:0      收藏:0      [点我收藏+]

项目需要,字段应该设计为timestamp类型,但自动建表后总是被设置为datetime


Google后,在配置文件(Xxx.hbm.xml)中column添加

sql-type="timestamp" default="CURRENT_TIMESTAMP"

后自动创建表后字段被设定为timestamp,默认为当前时间。


完整字段配置:

<property name="recordTime" type="java.sql.Timestamp">
            <column name="recordTime" not-null="true" sql-type="timestamp" default="CURRENT_TIMESTAMP"/>
        </property>


本文出自 “老谢” 博客,谢绝转载!

hibernate自动建表设定字段类型为timestamp

原文:http://jormin.blog.51cto.com/6136596/1359647

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!