hibernate反向生成

1.在Myeclipse Database Explore中创建一个库的链接。

2.在Myeclipse中创建一个web工程,添加反向生成相关的引用。即在项目上右键,弹出Myeclipse选择add hibernateCapbility

3.在Myeclipse Database Explore中选择要反向生成的表,右键弹出Hibernate Reverse engineering

4.如下选择后next

 

 

注:其中的update hibernate configuration with mapping resource location项与注解无关。

选择update hibernate configuration with mapping resource location用来生成hibernate的配置文件是hibernate.cfg.xml。

5.然后勾选generate version and timestamp tags。

 

注:其中的enable many-to-many detection 作用是在存在多对多时用many-to-many代替many-to-one.,这样会使得中间表无单独对应的映射文件。

6.如果要单项关联选Include referenced tables,如果要双向关联则还要选include referencing tables  。

即包含反向工程时当前数据库表引用的表格以及其它引用到当前表的数据库表.

效果如:.

 

注: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.
生成关联到当前表格的关联表的尚未反向工程过的代码, 这些表在当前配置页面尚未被显示。其效果如下:

 

转载于:https://www.cnblogs.com/shz365/p/3528719.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值