自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

iBATIS for Eclipse設(shè)置淺析

開發(fā) 后端
iBATIS for Eclipse設(shè)置是什么呢?如何你不清楚或者沒有頭緒,那么本文將會(huì)給你一個(gè)介紹。

iBATIS for Eclipse設(shè)置問題我們要從頭說起,對(duì)于IBatis應(yīng)用最煩人的重復(fù)工作就是不停的寫DAO,DTO,和xml文件里面的sqlmap,其實(shí)很多時(shí)候這些工作是重復(fù)而且無聊的。好在我們還有abator (http://ibatis.apache.org/abator.html ),一個(gè)IBatis自動(dòng)生成工具,他可以幫助你生成大量的DAO,DTO和sqlmap。

如果你使用Eclipse作為IDE那么事情就很簡(jiǎn)單了(相信沒有幾個(gè)人不在用):

安裝Eclipse插件

1. 要求eclipse3.1,jdk1.4以上

2. 在Eclipse上安裝abator插件

Eclipse菜單欄 --﹥ help --﹥ Software Updates --﹥ Find And Install...

在彈出的對(duì)話框中選擇 “Search for new features to install” 然后點(diǎn)擊 “next”

在對(duì)話框中點(diǎn)擊按鈕 New Remort Site... 在彈出的對(duì)話框中的URL輸入框中填寫 http://ibatis.apache.org/tools/abator ,Name輸入框就隨便寫些什么了。

點(diǎn)擊Finish,安裝插件,然后重新啟動(dòng)Eclipse

下面測(cè)試一下功能

1. 新建一個(gè)java工程

2. 在Eclipse菜單欄中興建一個(gè) abator 配置文件

File --﹥ Abator for iBatis Configration File

好的,我們完成了創(chuàng)建配置文件,下面打abator配置文件,看看里面怎么去配置

打開后內(nèi)容基本上是這樣

xml 代碼

  1. ?xml v﹤ersion="1.0" encoding="UTF-8"?﹥     
  2. ﹤!DOCTYPE abatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Abator for iBATIS Configuration 1.0//EN"  
  3.    "http://ibatis.apache.org/dtd/abator-config_1_0.dtd"﹥     
  4.      
  5. ﹤abatorConfiguration﹥     
  6.   ﹤abatorContext﹥﹤!-- TODO: Add Database Connection Information --﹥     
  7. ﹤jdbcConnection driverClass="???"     
  8. connectionURL="???"     
  9. userId="???"     
  10. password="???"﹥     
  11.   ﹤classPathEntry location="???" /﹥     
  12. ﹤/jdbcConnection﹥     
  13.      
  14. ﹤javaModelGenerator targetPackage="???" targetProject="???" /﹥     
  15. ﹤sqlMapGenerator targetPackage="???" targetProject="???" /﹥     
  16. ﹤daoGenerator type="IBATIS" targetPackage="???" targetProject="???" /﹥     
  17.      
  18. ﹤table schema="???" tableName="???"﹥     
  19.   ﹤columnOverride column="???" property="???" /﹥     
  20. ﹤/table﹥     
  21.      
  22.   ﹤/abatorContext﹥     
  23. ﹤/abatorConfiguration﹥   

 你需要做的是替換一些???:

1. 填寫driverClass(jdbc驅(qū)動(dòng),例如oracle的就是oracle.jdbc.driver.OracleDriver)

2. 填寫connectionURL(連接字符串,例如oracle的就是jdbc:oracle:thin:@192.168.0.246:1521:test)

3. 填寫classPathEntry的location(jdbc驅(qū)動(dòng)jar包的位置,例如E:/project/ibatistest/WebContent/WEB-INF/lib/ojdbc14.jar)

4. 填寫javaModelGenerator,生成的DTO(java model 類)

targetPackage:目標(biāo)包的位置,如 com.test.dto

targetProject:目標(biāo)工程名稱,填寫配置文件所在的Eclipse工程名

5. 填寫sqlMapGenerator ,生成的xml sqlmap的相關(guān)配置

targetPackage:目標(biāo)位置,如 com.test.sqlmap

targetProject:目標(biāo)工程名稱,填寫配置文件所在的Eclipse工程名

6. 填寫daoGenerator ,生成的DAO的相關(guān)配置

type:生成的dao實(shí)現(xiàn)的類型,如果你使用spring的話寫SPRING,否則寫IBATIS

targetPackage:目標(biāo)位置,如 com.test.dao

targetProject:目標(biāo)工程名稱,填寫配置文件所在的Eclipse工程名

7. 配置相關(guān)數(shù)據(jù)庫的表

schema:數(shù)據(jù)庫schema,oracle就是填寫數(shù)據(jù)庫的用戶名

tableName:表名

xml 代碼

  1. ﹤columnOverride column="???" property="???" /﹥    

可以先不用配置,刪除就可以了

下面開始生成:

在配置文件上點(diǎn)解右鍵,選擇 “Generate iBatis Artifacts”

OK,看看生成了什么吧!

iBATIS for Eclipse設(shè)置問題就介紹到這里,是不是有點(diǎn)明白了呢?趕緊動(dòng)手嘗試吧。

【編輯推薦】

  1. iBATIS是什么?
  2. iBATIS的優(yōu)、缺點(diǎn)及注意事項(xiàng)淺談
  3. iBATIS操作Blob與Clob淺析
  4. iBATIS讀寫CLOB數(shù)據(jù)淺析
  5. iBATIS操作CLOB字段實(shí)戰(zhàn)淺析
責(zé)任編輯:仲衡 來源: 百度空間
相關(guān)推薦

2009-07-21 11:12:00

iBATIS配置

2009-07-17 10:32:45

iBATIS MapB

2009-07-22 10:03:11

iBATIS Resu

2009-07-16 09:14:26

iBATIS DAO

2009-07-20 18:00:16

iBATIS DAO事

2009-07-15 17:58:07

iBATIS 動(dòng)態(tài)映射

2009-07-16 10:23:30

iBATIS工作原理

2009-07-22 10:42:59

iBATIS Cach

2009-07-14 14:18:41

Myeclipse E代碼提示

2009-07-16 13:08:09

iBATIS快速創(chuàng)建應(yīng)

2009-07-17 17:05:44

iBATIS緩存cacheModel

2009-07-22 15:21:00

iBATIS SQLM

2009-07-22 09:44:05

iBATIS Para

2009-07-15 16:42:03

iBATIS讀寫CLO

2009-07-22 16:02:14

iBATIS參數(shù)

2009-07-17 10:59:59

iBATIS接口

2009-07-17 09:44:40

iBATIS教程

2009-07-22 15:01:01

iBATIS SQLM

2009-07-17 16:49:18

iBATIS XML配

2009-07-15 16:26:04

iBATIS Clob
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)