hibernate中怎么根据数据库表自动生成映射文件和java类?

举报 回答
hibernate中怎么根据数据库表自动生成映射文件和java类?
问在线客服
扫码问在线客服
  • 回答数

    10

  • 浏览数

    6,963

举报 回答

10个回答 默认排序
  • 默认排序
  • 按时间排序

没找到满意答案?去问秘塔AI搜索
取消 复制问题
已采纳
用Myeclipse,首先要有自己的数据源,找到Myeclipse DataBase Explorer,就可以看到数据库中的所有表,找到你想要的表,右键选择Hibernate reverse Engineering 剩下的步骤你应该就明白了! 有找不到的在问我!
取消 评论
1、2:Expands the set of tables to be reverse engineered to other tables referenced by this table and tables referencing this table respectively.
包含反向工程时当前数据库表引用的表格以及其它引用到当前表的数据库表.

3、4 :Generate code corresponding to the relationships this table has with other tables which are not being currently reverse engineered and are absent from the table list on this page.
生成关联到当前表格的关联表的尚未反向工程过的代码, 这些表在当前配置页面尚未被显示.
取消 评论
用myeclipse8.6吧 我一直用这个 。挺好用的
取消 评论
没有主键,就更改他的生成策略呗,一般用native或者assigned
取消 评论
应该是你选择的问题。不应该,自习按步骤来啊
取消 评论
你好

hbm 中设定

property name=rigster_time type=timestamp
column name=REGISTER_TIME length=23 /
/property
取消 评论
主要`看你的实体的类型和数据库表中列的类型对不对应`不对应肯定不行
一般数据库sql Server 是timestamp (我的拼写可能是错的) 这个是参数是long
所以
private Timestamp createTime;

***.setCreateTime(new Date());
一般这样
实体类最好用hibernate反向生成
取消 评论
必须设置主键不然不行代码如下:
id name=id type=java.lang.Integer
column name=id/
generator class=native/
/id
取消 评论
加载全部10个答案 加载中...
ZOL问答 > hibernate中怎么根据数据库表自动生成映射文件和java类?

举报

感谢您为社区的和谐贡献力量请选择举报类型

举报成功

经过核实后将会做出处理
感谢您为社区和谐做出贡献

扫码参与新品0元试用
晒单、顶楼豪礼等你拿

扫一扫,关注我们
提示

确定要取消此次报名,退出该活动?