ibatorconfig.xml mysql_iBATOR介绍,什么是iBATOR?

iBATOR是一个代码生成器,用于iBATIS。 iBATOR内部检查的一个或多个数据库表和将生成iBATIS的工件,可用于访问表。

稍后,您可以编写自定义的SQL代码或存储过程来满足您的要求。 iBATOR产生以下项目:

SqlMap XML文件

Java类相匹配的表的主键和字段

使用上述对象DAO类(可选)

iBATOR可以运行作为一个独立的JAR文件,或作为一个Ant任务,或者作为一个Eclipse插件。本教程将教你生成iBATIS的配置文件格式命令行的简单的方法。

下载iBATOR:

如果您使用的IDE是Eclipse,比其他下载独立的JAR。独立的JAR包括一个Ant任务来运行iBATOR,或者您也可以从Java代码中的命令行运行iBATOR。

You can download zip file from Download iBATOR.

You can check online documentation: iBATOR Documentation.

Generating Configuration File:

To get up and running quickly with Abator, follow these steps:

Step 1:

Create and fill out a configuration file ibatorConfig.xml appropriately. At a minimum, you must specify:

A  element to specify how to connect to the target database.

A  element to specify target package and target project for generated Java model objects

A  element to specify target package and target project for generated SQL map files.

A  element to specify target package and target project for generated DAO interfaces and classes (you may omit the element if you don't wish to generate DAOs).

At least one database 

NOTE: See the XML Configuration File Reference page for an example of an Abator configuration file.

Step 2:

Save the file in some convenient location for example at: empibatorConfig.xml).

Step 3:

Now run Abator from the command line with a command line as follows:

java-jar abator.jar-configfile empabatorConfig.xml-overwrite

This will tell Abator to run using your configuration file. It will also tell Abator to overwrite any existing Java files with the same name. If you want to save any existing Java files, then omit the -overwriteparameter.

If there is a conflict, Abator will save the newly generated file with a unique name.

After running Abator, you will need to create or modify the standard iBATIS configuration files to make use of your newly generated code. This is explained in next section.

Tasks After Running Abator:

After you run Abator, you will need to create or modify other iBATIS configuration artifacts. The main tasks are as follows:

Create or Modify the SqlMapConfig.xml file.

Create or modify the dao.xml file (only if using the iBATIS DAO Framework).

Each task is described in detail below:

Updating the SqlMapConfig.xml File:

iBATIS uses an XML file, commonly named SqlMapConfig.xml, to specify information for a database connection, a transaction management scheme, and SQL map XML files that will be used in an iBATIS session.

Abator cannot create this file for you because Abator knows nothing about your execution environment. However, some of the items in this file relate directly to Abator generated items.

Abator specific needs in the configuration file are as follows:

Statement namespaces must be enabled.

Abator generated SQL Map XML files must be listed .

For example, suppose that Abator has generated an SQL Map XML file called MyTable_SqlMap.xml, and that the file has been placed in the test.xml package of your project. The SqlMapConfig.xml file should have these entries:

<?xml version="1.0"encoding="UTF-8"?>/p>

PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"

"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

If there is more than one SQL Map XML file (as is quite common), then the files can be listed in any order with repeated elements after the element.

Updating the dao.xml File:

The iBATIS DAO framework is configured by an xml file commonly called dao.xml.

The iBATIS DAO framework uses this file to control the database connection information for DAOs, and also to list the DAO implementation classes and DAO interfaces.

In this file you should specify the path to your SqlMapConfig.xml file, and all the Abator generated DAO interfaces and implementation classes.

For example, suppose that Abator has generated a DAO interface called MyTableDAO and a implementation class called MyTableDAOImpl, and that the files have been placed in the test.dao package of your project.

dao.xml文件应该有这些项:

<?xml version="1.0"encoding="UTF-8"?>/p>

PUBLIC "-//ibatis.apache.org//DTD DAO Configuration 2.0//EN"

"http://ibatis.apache.org/dtd/dao-2.dtd">

NOTE: This step is only required if you generated DAOs for the iBATIS DAO framework.

¥ 我要打赏

纠错/补充

收藏

加QQ群啦,易百教程官方技术学习群

注意:建议每个人选自己的技术方向加群,同一个QQ最多限加 3 个群。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值