hibernate提供了几个专门的工具转hbm.xml,POJO,和数据库脚本的,hbm.xml是中间的,最好先生成这个,再用两个工具分别生成POJO和数据库脚本,名字分别是hbm2sql和hbm2名字都记不清了,在家里的笔记本上反向也能生成xml,有两个工具的。

解决方案 »

  1.   

    Hibernate has a toolset, you can use them to transfer database schema to hibenrate configuration file and pojoThe following path is the way for converting UML to database schemaUML Model--- AndroMDA -->pojo
    Pojo ---XDoclet --> Mapping files(*.hbm.xml)
    Mapping files(*.hbm.xml) --- SchemaExport(hbm2ddll) ---> database schemaThe folloing path is the way for converting database schema to Pojo
    database schema --- middlegen ---> Mapping files(*.hbm.xml)
    Mapping files(*.hbm.xml) --- CodeGenerator(hbm2java) ---> PojoYou can try to use the eclipse plug-in instead of hand coding. the plug -in can be downloaded from http://www.hibernate.org/255.html, and remember your eclipse version must be 3.1m5 or above.
      

  2.   

    从数据库生成hbm.xml可以使用Middlegen,从hbm.xml生成POJO可以使用hbm2java
    但是我的建议应该先设计POJO,再通过POJO生成hbm.xml和数据库表,因为一切都应该以对象为主。
      

  3.   

    ExadelStudio-2[1].5.2-plugin-3.exe,根据bean自动生成hbm.xml,
      

  4.   

    使用MyEclipse 4.0M2+Eclipse 3.1
      

  5.   

    使用MyEclipse 4.0M2+Eclipse 3.1    思路正确。问题,myeclipse出了4.0么?哪里下载?
      

  6.   

    myeclipse 的官方网站就有 注册个用户就可以下载
      

  7.   

    xdoclet,hibernate sync,tanghan.....
    hibernate还自带了根据pojo生成表以及根据表生成pojo,自己去hibernate找吧