首页 > 其他 > 详细

hibernate反向生成

时间:2014-01-21 21:28:08      阅读:577      评论:0      收藏:0      [点我收藏+]

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

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

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

4.如下选择后next

bubuko.com,布布扣

 

 

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

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

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

 bubuko.com,布布扣

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

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

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

效果如:bubuko.com,布布扣bubuko.com,布布扣.

bubuko.com,布布扣

 

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

 bubuko.com,布布扣

hibernate反向生成

原文:http://www.cnblogs.com/shz365/p/3528719.html

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