Javaren就是爪洼人!

          一起來研究java

          常用鏈接

          統(tǒng)計(jì)

          最新評(píng)論

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

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

          下面是build.xml文件中有關(guān)的一段:

          <!-- 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) 評(píng)論(0)  編輯  收藏 所屬分類: Hibernate 3.2.x


          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 石嘴山市| 库尔勒市| 临高县| 玉林市| 洪泽县| 温州市| 娄底市| 类乌齐县| 靖西县| 准格尔旗| 东至县| 平和县| 全椒县| 上蔡县| 东兰县| 茌平县| 鄄城县| 杭州市| 伊金霍洛旗| 襄樊市| 繁昌县| 双江| 乐业县| 怀来县| 洱源县| 南平市| 葫芦岛市| 榆林市| 扎鲁特旗| 大埔区| 灌南县| 前郭尔| 饶平县| 观塘区| 于都县| 大埔县| 中宁县| 察哈| 方山县| 胶南市| 三门峡市|