使用Abator工具来自动生成iBatis代码
1.安装
??1.1.下载安装?
?????? 首先,下载Abator插件,其Abator下载地址为: http://people.apache.org/builds/ibatis/alpha/AbatorForEclipse1.0.0.zip
?????? 其次,将插件使用link方式将其安装到Eclipse中,也可以进行Find And Install来本地安装.
? 2.1.Eclipse在线安装
?????? 2.1.1. 要求eclipse3.3,jdk1.4以上
?????? 2.1.2.eclipse菜单栏 --> help --> Software Updates --> Find And Install... ,
?????????????? 在弹出的对话框中选择 “Search for new features to install” 然后点击 “next”,
?????????????? 在对话框中点击按钮 New Remort Site... ,Name:Ibatis_Abator(任意),URL:http://ibatis.apache.org/tools/abator
?????????????? 点击Finish,安装插件,然后重新启动eclipse.
?????????????? 安装完成后,File-->new菜单下出现"Abator for iBATIS Configuration File"选项.
2.使用
2.1.新建一个java工程.
?? 2.2.在eclipse菜单栏中新建一个abator 配置文件: File -->new--> Abator for iBATIS Configuration File
?? 2.3.打开abator生成的配置文件(abatorConfig.xml)并修改
2.4.右键菜单选择Generate iBATIS Artifacts,生成文件
配置文件说明:
?例:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE abatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Abator for iBATIS Configuration 1.0//EN" "http://ibatis.apache.org/dtd/abator-config_1_0.dtd" >
<abatorConfiguration >
<abatorContext generatorSet="Java5">
<jdbcConnection driver
connectionURL="jdbc:oracle:thin:eric/eric@192.168.1.138:1521:PDORCL"
userId="root"
password="root" >
<classPathEntry location="D:\workspace\Ibatis_Abator\lib\ojdbc14.jar" />
</jdbcConnection>
<javaModelGenerator targetPackage="com.bean" targetProject="Ibatis_Abator" />
<sqlMapGenerator targetPackage="com.bean" targetProject="Ibatis_Abator" />
<daoGenerator targetPackage="com.bean" targetProject="Ibatis_Abator" type="SPRING" />
<table schema="" tableName="T_AFN_0C_F1" ></table>
<table schema="" tableName="T_AFN_0C_F100" ></table>
</abatorContext>
</abatorConfiguration>