ibatis代碼產生工具abator使用全過程

來源:互聯網
上載者:User
對初接觸者來說,到底如何開始使用abator,資源比較少,本文記載了我今日初次使用的過程,希望對和我一樣的初學者有所協助.

1、獲得
      http://ibatis.apache.org/abator.html
     Eclipse可以自動的進行Update擷取此Plugin,官方的安裝步驟.  

If you've already installed a prior version of Abator, simply run the Eclipse Install/Update tool and the new version will be found automatically.

If you've not already installed Abator, then you can use the built in Eclipse install support by following these steps: Take the "Help>Software Updates>Find and Install" Menu Option Select the "Search for new features to install" radio button, press "Next" Press the "New Remote Site" button Enter the following information: Name: Abator for Eclipse Update Site URL: http://ibatis.apache.org/tools/abator Press OK Check the box next to "Abator for Eclipse Update Site" Follow the remainder of the install wizard

2、安裝好後將在New菜單中看到一個新的檔案類型Abator for iBATIS Configuration File,此是Abator的設定檔,設定檔的詳細說明見http://ibatis.apache.org/docs/tools/abator/

3、建立一個設定檔,進行修改,根據自己的實際需求進行修改
關鍵點:
1)jdbcconnection,按照一般的配置即可,需要說明的是它需要指定訪問JdbcDriver的classPathEntry,對於MsSqlServer而言,要將這三個jar檔案均包含在內,否則會出現jdbc訪問錯誤。
2)配置三個Pakage
3)配置表,此處需說明的是對於MsSqlServer不能寫TableSchema,我初次指定TableSchema,結果未找到對應的表
簡單的配置如下,複雜的見設定檔的詳細說明。樣本設定檔如下
<abatorConfiguration>
  <abatorContext>    <!-- TODO: Add Database Connection Information -->
    <jdbcConnection driverClass="com.microsoft.jdbc.sqlserver.SQLServerDriver"
        connectionURL="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=whm;SelectMethod=cursor"
        userId="sa"
        password="sa">
      <classPathEntry location="C:/Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/mssqlserver.jar" />
      <classPathEntry location="C:/Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/msutil.jar" />
      <classPathEntry location="C:/Program Files/Apache Software Foundation/Tomcat 5.0/common/lib/msbase.jar" />
    </jdbcConnection>

    <javaModelGenerator targetPackage="com.dwerp.itatis.domain" targetProject="BhbManage" />
    <sqlMapGenerator targetPackage="com.dwerp.itatis.persistence.xml" targetProject="BhbManage" />
    <daoGenerator type="IBATIS" targetPackage="com.dwerp.itatis.persistence.sqlmapdao" targetProject="BhbManage" />

    <table tableName="BHBGL">
    
    </table>

  </abatorContext>
</abatorConfiguration>

4、按右鍵設定檔,點擊Generate iBatis Artifacts,組建檔案。 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.