设为首页收藏本站
开启辅助访问
切换到宽版

创星网络[分享知识 传递快乐]

 找回密码
 立即注册

QQ登录

只需一步,快速开始

用新浪微博登录

只需一步,快速搞定

搜索
查看: 5794|回复: 0
打印 上一主题 下一主题

[Eclipse&MyEclipse] Eclipse(MyEclipse)生成iBatis代码以及配置文件

[复制链接]

我玩的应用:

跳转到指定楼层
楼主
发表于 2013-6-29 08:47:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
一.安装插件
http://ibatis.apache.org/abator.html下载Eclipse Plugin。插件一共有2种安装方式.
1.远程安装.
eclipse->Help>Software Updates>Find and Install->Search for new features to install->
New Remote Site(name:Abator for Eclipse Update Site ,URL:http://ibatis.apache.org/tools/abator)
->OK->Abator for Eclipse Update Site->OK
2.手动安装.
http://ibatis.apache.org/abator.html下载AbatorForEclipse1.1.0.zip,下载后在eclipse中进行操作
eclipse->Help>Software Updates>Find and Install->Search for new features to install(press "Next" )->
New Local Site->选种刚才下载的文件->OK
二.建立一个项目
新建一个Eclipse项目,输入名字,然后选择文件>新建>ABator for iBatis configuration File,选择Location,并且键入File Name:abatorCsonfig.xml。
点击“完成”,Eclipse会在程序根目录下建立abatorCsonfig.xml文件,打开编辑它,内容如下:
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE abatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Abator for iBATIS Configuration 1.0//EN" "http://ibatis.apache.org/dtd/abator-config_1_0.dtd" >
  3. <abatorConfiguration >
  4.   <abatorContext >
  5.     <jdbcConnection driverClass="驱动" connectionURL="数据库URL" userId="用户名" password="密码" >
  6.       <classPathEntry location="数据库驱动jar包" />
  7.     </jdbcConnection>
  8.     <javaModelGenerator targetPackage="model层包路径" targetProject="src路径" />
  9.     <sqlMapGenerator targetPackage="map层包路径" targetProject="src路径" />
  10.     <daoGenerator targetPackage="dao层包路径" targetProject="src路径" type="IBATIS" />
  11.     <table schema="表名" tableName="表名" catalog="数据库名">一定要写上,不然会报错的。
  12.      
  13.     </table>
  14.   </abatorContext>
  15. </abatorConfiguration>
复制代码
在abatorCsonfig.xml上点击鼠标右键,选择Generate iBATIS Artifact,在src目录下会生成model、map、dao三个目录,文件也建立好了。
javaModelGenerator:我们常说的ValueObject
sqlMapGenerator:XML文件
daoGenerator:放置接口和DAO的代码

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享分享 分享淘帖
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|创星网络 ( 苏ICP备11027519号|网站地图  

GMT+8, 2024-5-3 13:12 , Processed in 0.078301 second(s), 28 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表