Javaren就是爪洼人!

          一起來研究java

          常用鏈接

          統計

          最新評論

          hibernate 3.2.5 使用hbm映射文件來生成java源代碼和ddl腳本

          Hibernate 3.2.x和2.x生成java源代碼和ddl腳本的方法差不多,但是使用的hibernate類包變新的了:
          org.hibernate.tool.ant.HibernateToolTask

          下面是build.xml文件中有關的一段:

          <!-- Generate the java code for all
            
          -- mapping files in our source tree -->
          <target name="hbm2java" depends="prepare"
              description
          ="Generate Java source">
              
          <taskdef name="hibernatetool"
                 classname
          ="org.hibernate.tool.ant.HibernateToolTask"
                 classpathref
          ="project.class.path"/>
              
          <hibernatetool destdir="${src}">
                
          <configuration
                    configurationfile
          ="${bin}/hibernate.cfg.xml"/>
                
          <hbm2java jdk5="true"/>
              
          </hibernatetool>
          </target>
          <!-- create ddl form  *.hbm.xml -->
          <target name="hbm2ddl" depends="prepare"
            description
          ="Generate DB schema from the O/R mapping files">
              
          <taskdef name="hibernatetool"
                classname
          ="org.hibernate.tool.ant.HibernateToolTask"
                classpathref
          ="project.class.path"/>
              
          <hibernatetool destdir="${sql}">
                 
          <configuration
                   configurationfile
          ="${bin}/hibernate.cfg.xml"/>
                 
          <hbm2ddl export="false" outputfilename="ddl.sql"/>
              
          </hibernatetool>
          </target>
          其中,
          <hbm2java jdk5="true"/>表示生成的java源文件是1.5以后的版本。

          posted on 2007-12-02 13:41 Terry Lee 閱讀(918) 評論(0)  編輯  收藏 所屬分類: Hibernate 3.2.x


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 广宗县| 军事| 屏东市| 将乐县| 济宁市| 香格里拉县| 岳阳市| 宜兰市| 肇州县| 田阳县| 青铜峡市| 清原| 新沂市| 全椒县| 连江县| 高淳县| 镶黄旗| 平罗县| 鄂托克前旗| 利辛县| 武鸣县| 蒙山县| 水城县| 丽水市| 曲沃县| 高陵县| 襄城县| 梁河县| 政和县| 腾冲县| 崇明县| 柘城县| 通海县| 湾仔区| 大庆市| 桦甸市| 宜都市| 南雄市| 洱源县| 楚雄市| 九龙县|