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

     

  • 相关阅读:
    Solution: Win 10 和 Ubuntu 16.04 LTS双系统, Win 10 不能从grub启动
    在Ubuntu上如何往fcitx里添加输入法
    LaTeX 笔记---Q&A
    Hong Kong Regional Online Preliminary 2016 C. Classrooms
    Codeforces 711E ZS and The Birthday Paradox
    poj 2342 anniversary party
    poj 1088 滑雪
    poj 2479 maximum sum
    poj 2481 cows
    poj 2352 stars
  • 原文地址:https://www.cnblogs.com/shz365/p/3528719.html
Copyright © 2011-2022 走看看