`
zhouxingfu520
  • 浏览: 418277 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

eclipse 配置ibtais插件

 
阅读更多

eclipse 远程安装ibatis插件 自动生成model、map、dao 类。

 

 一:安装ibatis插件 步骤如下

eclipse->Help>Install New Software>Find and Install->add->
 (name:ibatis ,URL:http://ibatis.apache.org/tools/abator )
 ->OK->Abator for Eclipse Update Site->OK  如下图

 

 点击add 弹出下图 输入地址 点击ok

 

选择一个 点击next直到结束

 

插件安装完了  我们还要在项目新建个文件 配置要自动生成哪些内容 我这里包括model、map、dao 类。

二.建立一个项目

新建一个Eclipse项目,输入名字,然后选择文件>新建>ABator for iBatis configuration File,选择Location,并且键入File Name:abatorCsonfig.xml。

点击“完成”,Eclipse会在程序根目录下建立abatorCsonfig.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>
<jdbcConnection driverClass="驱动" connectionURL="数据库URL" 
userId="用户名" password="密码" >
<!--我的 location=D:\setup\lib\classes12.jar-->
 <classPathEntry location="数据库驱动jar包路径" />
    </jdbcConnection>
<!--我的<javaModelGenerator targetPackage="com.portal.model"targetProject="extDemo/src"/>-->
    <javaModelGenerator targetPackage="model层包路径" targetProject="src路径" />
    <sqlMapGenerator targetPackage="map层包路径" targetProject="src路径" />
    <daoGenerator targetPackage="dao层包路径" targetProject="src路径" type="GENERIC-CI" />

   <!-- 我的配置 生成哪些对象映射 就要加上去表名称-->
    <table schema="表名" tableName="表名">
	</abatorContext>
</abatorConfiguration>
 

最后右键运行配置文件 如下图

 

完成生成 如下图

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics