您的位置:首页 > 编程语言 > Java开发

使用Eclipse3.2(MyEclipse)+ abator自动生成iBatis代码以及配置文件的方法

2010-08-29 19:42 1281 查看
使用Eclipse3.2(MyEclipse)+ abator自动生成iBatis代码以及配置文件的方法

转自:http://hi.baidu.com/ecspell/blog/item/1af66e811e4626dbbc3e1efd.html

注意:http://ibatis.apache.org/tools/abator 对应的是eclipse3.2 ;我在myeclipse6.0(eclipse3.3)上没用试验成功

一.安装插件Abator

Abator for Eclipse Update Site

This is the Abator for Eclipse update site. If you're not sure what Abator is, then see this page http://ibatis.apache.org/abator.html
If you've already installed a prior version of Abator for Eclipse, then simply run the Eclipse Install/Update tool and any 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:

1. Take the "Help>Software Updates>Find and Install" Menu Option

2. Select the "Search for new features to install" radio button, press "Next"

3. Press the "New Remote Site" button

4. Enter the following information:

Name:

Abator for Eclipse Update Site

URL:

http://ibatis.apache.org/tools/abator

5. Press OK

6. Check the box next to "Abator for Eclipse Update Site"

7. Follow the remainder of the install wizard

3、插件完成后,建立一个项目ibatisTest,然后选择文件>新建>ABator for iBatis configuration File,默认文件名,点击“完成”。修改刚才的文件abatorConfig.xml,把里面的相关“?”根据自己的实际情况替换如下,我的是这样的。

<?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> <!-- TODO: Add Database Connection Information -->

<jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"

connectionURL="jdbc:oracle:thin:@localhost:1521:orcl"

userId="spell"

password="spell">

<classPathEntry location="G:/techinfo/javaLib/DB_Jar/oracle/classes12.jar" />

</jdbcConnection>

<javaModelGenerator targetPackage="com.spell.model" targetProject="ibatisTest/src" />

<sqlMapGenerator targetPackage="com.spell.map" targetProject="ibatisTest/src" />

<daoGenerator type="IBATIS" targetPackage="com.spell.dao" targetProject="ibatisTest/src" />

<table schema="SPELL" tableName="members" catalog="members">

</table>

</abatorContext>

</abatorConfiguration>

5、 在abatorConfig.xml上点击鼠标右键,选择Generate iBATIS Artifact,在src目录下会生成com.spell.model、com.spell.map、com.spell.dao三个目录,文件也建立好了。 其他有什么要修改的就自己动手吧~~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐