从http://ibatis.apache.org/abator.html下载Eclipse Plugin。插件一共有2种安装方式,在网页上都有介绍。
2、 新建一个Eclipse项目,项目名称为myibatis,然后选择文件>新建>ABator for iBatis configuration File,选择Location,并且键入File Name:abatorCsonfig.xml。
字串6
3、 点击“完成”,Eclipse会在程序根目录下建立abatorCsonfig.xml文件,打开编辑它,内容如下:
字串7
<?xml version="1.0" encoding="UTF-8"?>
字串8
<!DOCTYPE abatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Abator for iBATIS Configuration 1.0//EN" 字串5
"http://ibatis.apache.org/dtd/abator-config_1_0.dtd">
字串4
字串2
<abatorConfiguration>
字串5
<abatorContext> <!-- TODO: Add Database Connection Information -->
字串3
<jdbcConnection driverClass="oracle.jdbc.OracleDriver"
字串2
connectionURL="jdbc:oracle:thin:@210.11.11.11:1521:iisg" 字串1
userId="test"
字串5
password=" test ">
字串2
<classPathEntry location="D:/project/jar/classes12.jar" />
字串5
</jdbcConnection>
字串5
字串1
<javaModelGenerator targetPackage="com.soho.model" 字串7
targetProject="myibatis/src" />
字串2
<sqlMapGenerator targetPackage="com. soho.map" targetProject="myibatis/src" />
字串1
<daoGenerator type="IBATIS" targetPackage="com. soho.dao"
字串6
targetProject="myibatis/src" /> 字串7
<table catalog="thibernate" schema="thibernate" tableName="taddress" domainObjectName="TAddress">
字串4
</table>
字串4
</abatorContext>
字串5
</abatorConfiguration> 字串6
4、 注意<table catalog="test" schema="test" tableName="taddress" domainObjectName="TAddress"></table>中的catalog="test" schema="test",这个一定要写上,不然会报错的。 字串8
5、 在abatorCsonfig.xml上点击鼠标右键,选择Generate iBATIS Artifact,在src目录下会生成com.soho.model、com. soho.map、com. soho.dao三个目录,文件也建立好了。
字串7
6、 javaModelGenerator:我们常说的ValueObject 字串8
7、 sqlMapGenerator:XML文件 字串2
8、 daoGenerator:放置接口和DAO的代码
Tags: myeclipse Abator 自动 ibatis 代码 配置
原创文章如转载,请注明:转载自:飞扬部落编程仓库 : http://www.busfly.net/csdn/
如果你喜欢本文,请顶一下,支持我,你的支持是我继续发好文章的最大动力。谢谢。
好东西需要分享,快把本文发给你的朋友吧~!~