Ibato
r
生成ibatis
配置文件
作者:×××
日期:2009-06-08 15.03
版本:0.1
Ibator能给我们带来什么
由于使用Ibatis
时需要生成的配置文件较多,而且对于字段较多的表生成其
Ibatis
实体时容易出错,使用
Ibators
插件能减少我们很多枯燥的工作,提高正确性和准确率。
准备工作
Eclipse Platform
Version: 3.4.2
;
Ibator官方网站
,
Ibator:
1.2.1
;
安装Ibator
插件,可以使用本地方式安装,也可以使用
Update side
方式安装,为了方便,这里使用
update side
方式安装(引自官网):
Automatic Eclipse Install
If you've already installed a prior version of Ibator, simply run the Eclipse Update tool and the new version will be found automatically.
If you've not previously installed Ibator, use the built in Eclipse install support by following these steps:
1.
Take the "Help>Software Updates..." Menu Option
2.
Select the "Available Software" Tab
3.
Press the "Add Site" button
4.
Enter the following information: Location,http://ibatis.apache.org/tools/ibator
5.
Press OK
6.
Check the box next to "Apache iBATIS Ibator Feature"
7.
Press the "Install" button
8.
Follow the remainder of the install wizard
(restart you eclipse IDE)
|
插件安装成功之后,
在“File->New
”菜单里将会有一个新选项,如下图:
在鼠标右键上,也会有一个新的选项,如下图:
示例
步骤如下:
1.
生成ibatorConfig.xml
配置文件,关于配置文件详细注释参见:
Introduction to Abator
;
2.
配置数据库连接(驱动,URL
,
User
,
Psd
,
etc
);
3.
配置Java Model Generator
参数;
4.
配置SQL Map Generator
参数;
5.
配置DAO Generator
参数;
6.
配置需要生成Ibatis
配置的表;
7.
“右键”选择“
”完成操作;
完整示例配置文件如下:
<
ibatorConfiguration
>
<
classPathEntry
location
=
"E:/workspace/antx/repository/jdbc/oracle/ojdbc14.jar"
/>
<
ibatorContext
id
=
"context1"
>
<
jdbcConnection
driverClass
=
"oracle.jdbc.driver.OracleDriver"
connectionURL
=
"jdbc:oracle:thin:@10.2.224.34:1521:aepdb"
userId
=
"core"
password
=
"core"
/>
<
javaModelGenerator
targetPackage
=
"com.alisoft.model"
targetProject
=
"test/src/"
>
<
property
name
=
"enableSubPackages"
value
=
"false"
/>
<
property
name
=
"trimStrings"
value
=
"true"
/>
</
javaModelGenerator
>
<
sqlMapGenerator
targetPackage
=
"com.alisoft.model.sql"
targetProject
=
"test/src/"
>
<
property
name
=
"enableSubPackages"
value
=
"false"
/>
</
sqlMapGenerator
>
<
daoGenerator
targetPackage
=
"com.alisoft.dao"
targetProject
=
"test/src/"
type
=
"GENERIC-CI"
>
<
property
name
=
"enableSubPackages"
value
=
"false"
/>
</
daoGenerator
>
<
table
tableName
=
"ADMIN_USER"
domainObjectName
=
"Admin"
/
>
</
ibatorContext
>
</
ibatorConfiguration
>
|
补充说明:
1.
如果指定的
targetPackage
不存在,Ibator
会帮我们自动生成;
2.
根据官方文档描述,"
daoGenerator
"是一个可选配置,但是实际情况是不配置该选项
xml
验证能通过,但是会报一个类似空指针的错误;
3.
以上描述均在本人机器上测试通过;
分享到:
相关推荐
NULL 博文链接:https://dr-yanglong.iteye.com/blog/1936559
这是一个用iBator生成iBatis有关代码的例子。 特别说明: Eclipse应该是3.4.1以上版本, 并且安装了iBator插件。否则可用iBator的命令行版本或ant工具。 测试用数据是: CREATE TABLE PERSON( id INTEGER NOT NULL,...
NULL 博文链接:https://xiao9.iteye.com/blog/954159
自动生成dto\dao\xml 自带批处理自动生成程序
ibatis 配置文件自动生成工具
ibator-huoniao通过它你可以通过配置少量参数,通过一键生成dao层的全部文件,能够应付对dao层的所有操作 产物包括: 1. pojo文件 2. dao接口类 3. dao接口实现类文件 4. ibatis sql map文件 5. 数据库查询时...
帮你快记迅生成ibatis相关的dao,sqlmap,以及pojo类,帮你大大简化开发步骤,我已经测试过了,相相当的好用。
ibatis ibator eclipes插件 代码生成器 代码自动生成工具 下载后将features和plugins两个文件夹下的文件拷贝到eclipes安装路径下对应的features和plugins两个文件夹下即可
iBATIS课件 iBATIS简介 搭建环境 配置文件 读取配置 基本的CRUD操作 模糊查询 iBATIS代码生成工具iBATOR 优缺点 选择Hibernate还是iBATIS
GameServer一个服务器处理框架,包括 协议处理,消息处理,持久层数据...来对服务器的管理使用ibatis做持久层采用ibator做自动代码生成工具,减少开发中对数据库编码的工作量使用mina2.0.9做网络通信提供网络通信的性