smartzxy 2009-06-09 18:16
浏览 203
已采纳

求Hibernate中由pojo生成hbm的工具

请问各位前辈,你们在实际开发中通过破解哦生成hbm文件(pojo优先模式)时,都用什么工具啊?除了myeclipse……

  • 写回答

6条回答 默认 最新

  • fancyyesnot 2009-06-09 21:16
    关注

    你可以采用Xdoclet和ant结合:
    /**

    • @hibernate.class
    •  table="T_Party"
      

      */
      public class Party {

      /**

      • @hibernate.id
      • generator-class="native" */ private int id;

      /**

      • @hibernate.many-to-one
      • column="parentid"
        */ private Party parent;

      /**

      • @hibernate.set
      • @hibernate.key
      • column = "parentid"
      • @hibernate.one-to-many
      • class = "com.bjsxt.oa.model.Party"
        */ private Set children; ant文件中你可以定义: <?xml version="1.0" encoding="GBK"?>












      name="xdoclet"
      classname="org.xdoclet.ant.XDocletTask"
      classpathref="xdoclet.task.classpath"
      />







      classname="org.xdoclet.plugin.hibernate.HibernateConfigPlugin"
      destdir="${src.dir}"
      version="3.0"
      hbm2ddlauto="update"
      jdbcurl="jdbc:mysql://127.0.0.1/oa_200706"
      jdbcdriver="com.mysql.jdbc.Driver"
      jdbcusername="root"
      jdbcpassword="mysql"
      dialect="org.hibernate.dialect.MySQLDialect"
      showsql="true"
      />







      classname="org.xdoclet.plugin.hibernate.HibernateMappingPlugin"
      version="3.0"
      destdir="${src.dir}"
      />


    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?