分享

Ibator的配置与使用

 昵称1794186 2010-09-08


一、Ibator插件安装
两种方法安装其插件
1.下载Ibator插件,可在Eclipse中在线更新或者网上下载,在线更新的地址为:
http://ibatis./tools/ibator
网上下载网址为:
http://people./builds/ibatis/ibator/IbatorForEclipse1.2.1.zip
可在下面网址查找最新版本:http://ibatis./ibator.html
2.直接下载插件分别将plugins和features目录下的包文件放在Eclipse中的对应目录下,可下载附件中的ibator插件
二、ibator使用及配置
1.Eclipse环境中新建一个项目,选择该项目右键新建Apache iBATIS Ibator下 Apache iBATIS Ibator Configuration File,会在项目中生成ibatorConfig.xml文件
2.打开之后,在ibatorConfiguration元素下增加一个 <classPathEntry location="E:/ojdbc14.jar"/>,指定你的包文件路径。
location指定为oracle的安装目录下的lib目录中的ojdbc14.jar,例如:E:\oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar
3.填写<ibatorContext id="context1" >元素下的内容,我的配置如下:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "
http://ibatis./dtd/ibator-config_1_0.dtd" >
<ibatorConfiguration >
<classPathEntry location="E:/ojdbc14.jar"/>
<ibatorContext id="context1" >
    <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver" connectionURL="jdbc:oracle:thin:@10.17.32.66:1521:LAB1107" userId="lab1107" password="lab1107" />
    <javaModelGenerator targetPackage="com.isbn.bean" targetProject="kk" />
    <sqlMapGenerator targetPackage="com.isbn.app.map" targetProject="kk" />
    <daoGenerator targetPackage="com.test.dao" targetProject="kk" type="GENERIC-CI" />
    <table schema="LAB1107" tableName="T_B_USER" >
    </table>
</ibatorContext>
</ibatorConfiguration>

如果出现/by zero的错误,则将table中的schema="LAB1107"删掉。
4.选择ibatorConfiguration鼠标右键选择Gneric IBATIS Aritifest,然后可在原文件中看到生成对应的DAO、SQLMAP以及Bean文件,至此转换完成。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多