Ibatis之Eclipse开发插件——Ibator的安装及ibatorConfig.xml的配置

原创 2011年01月19日 17:28:00

Ibatis之Eclipse开发插件——Ibator

1、插件简介

Ibator is a code generator for iBATIS. Ibator will introspect a database table (or many tables) and will generate iBATIS artifacts that can be used to access the table(s). This abates some of the initial nuisance of setting up objects and configuration files to interact with database tables. Ibator seeks to make a major impact on the large percentage of database operations that are simple CRUD (Create, Retrieve, Update, Delete). You will still need to hand code SQL and objects for custom queries, or stored procedures.

Ibator产生的文件有:
  • SqlMap XML Files
  • Java Classes to match the primary key and fields of the table(s)
  • DAO Classes that use the above objects (optional)
Ibator can run as a standalone JAR file, or as an Ant task, or as an Eclipse plugin.

2、插件安装

        我们可以借助Eclipse来安装,当然也可以直接到http://ibatis.apache.org/ibator.html下载,然后解压,将相应的的文件拷贝到eclipse目录。

        2.1、Eclipse自动安装

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:
  • Take the "Help>Software Updates..." Menu Option
  • Select the "Available Software" Tab
  • Press the "Add Site" button
  • Enter the following information:
    Location:
    http://ibatis.apache.org/tools/ibator
  • Press OK
  • Check the box next to "Apache iBATIS Ibator Feature"
  • Press the "Install" button
  • Follow the remainder of the install wizard


        2.2、Eclipse手动安装

The automatic install is much preferred, but you can also install Ibator manually if you desire. To install manually, download the file IbatorForEclipse1.2.1.zip and unzip the file to some convenient location. After unzipping the update site archive, follow these steps in Eclipse:
  • Take the "Help>Software Updates..." Menu Option
  • Select the "Available Software" Tab
  • Press the "Add Site" button
  • Press the "Local" button
  • Navigate to the location where you unzipped the site archive
  • Press OK
  • Check the box next to "Apache iBATIS Ibator Feature"
  • Press the "Install" button
  • Follow the remainder of the install wizard
3、ibatorConfig.xml文件配置示例(该示例基于Maven项目管理)

引用

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ibatorConfiguration PUBLIC "-//Apache Software Foundation//DTD Apache iBATIS Ibator Configuration 1.0//EN" "http://ibatis.apache.org/dtd/ibator-config_1_0.dtd" >
<ibatorConfiguration>

 <!--配置驱动jar-->
 <classPathEntry
  location="${user.home}/.m2/repository/postgresql/postgresql/8.1-408.jdbc3/postgresql-8.1-408.jdbc3.jar" />

 <ibatorContext id="context1">
  <!--数据库连接-->
  <jdbcConnection driverClass="org.postgresql.Driver"   connectionURL="jdbc:postgresql://127.0.0.1:5432/test_site" userId="test"   password="123456"> </jdbcConnection>

  <javaTypeResolver>
   <property name="forceBigDecimals" value="false" />
  </javaTypeResolver>

  <!--产生Java类,该类的属性与数据库的列名一一对应,targetPackage为产生的类的包名-->
  <javaModelGenerator targetPackage="org.jpxx.test.common.dal.ibatis.model"
   targetProject="test/src/main/java/">
   <property name="enableSubPackages" value="true" />
   <property name="trimStrings" value="true" />
  </javaModelGenerator>

 <!--SqlMap XML 文件-->
  <sqlMapGenerator targetPackage="sqlmap"
   targetProject="test/src/main/resources/">
   <property name="enableSubPackages" value="true" />
  </sqlMapGenerator>

 <!--DAO类的产生配置-->
  <daoGenerator targetPackage="org.jpxx.test.common.dal.ibatis.dao"
   implementationPackage="org.jpxx.sec.common.dal.ibatis.dao.impl"
   targetProject="test/src/main/java/" type="GENERIC-SI">
   <property name="enableSubPackages" value="true" />
  </daoGenerator>

  <!-- 数据库表的相关配置 -->
  <table schema="" tableName="admin" domainObjectName="Admin">
   <property name="useActualColumnNames" value="false" />
   <property name="enableInsert" value="true" />
   <property name="enableSelectByPrimaryKey" value="true" />
   <property name="enableUpdateByPrimaryKey" value="true" />
   <property name="enableDeleteByPrimaryKey" value="true" />
  </table>
  
  <table schema="" tableName="college_image" domainObjectName="Photo">
   <property name="useActualColumnNames" value="false" />
   <property name="enableInsert" value="true" />
   <property name="enableSelectByPrimaryKey" value="true" />
   <property name="enableUpdateByPrimaryKey" value="true" />
   <property name="enableDeleteByPrimaryKey" value="true" />
   
   <property name="enableSelectByExample" value="false" />
   <property name="enableDeleteByExample" value="false" />
   <property name="enableCountByExample" value="false" />
   <property name="enableUpdateByExample" value="false" />
   <property name="selectByExampleQueryId" value="false" />
  </table>
 <!-- 数据库表的相关配置结束 -->

 </ibatorContext>
</ibatorConfiguration>


4、执行Ibator
 
         选中 ibatorConfig.xml 右键Generate iBATIS Artifacts.
版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

iBatorConfig.xml详解

1、Abator生成Java类文件时,根据注释区分属性和方法是系统生成或用户自定义,以此决定保留或者覆写.  2、Abator生成SQLMap的xml文件时,根据元素id是否包含前缀 ibatorge...

Ibator插件安装与配置

下载地址(供本地安装): 现在我们着手来写一个ibatis的简单例子. 如果你是使用eclipse开发项目的话,那么,有一个eclipse的插件ibator,可以通过配置自动生成java代码s...

Ibator插件安装、配置及使用说明

Ibator是iBATIS的代码发生器,其原名叫abator,后来更名为Ibator,同时代码结构也做了相应的一些修改,所以两者的配置也有所不同。Ibator可以生成一个数据库中的一个表(或多个表)的...

ibator插件+ibatorConfig文件

  • 2014-07-14 14:24
  • 2.77MB
  • 下载

ibator 插件 abator配置详解(ibatis自动生成实体类)

1.安装abator插件, 用自动的就好. url:http://ibatis.apache.org/tools/abator.安装就不用多说了. 2.安装完成后.在新建的框框中就会多了一个.Aba...

最新iBATIS的代码发生器Ibator插件安装及使用

1.     Ibator介绍 Ibator是iBATIS的代码发生器,其原名叫abator,后来更名为Ibator。如果从网上找到的是abator,它的插件地址现在已不支持。而且两者的配置也有所不...

Eclipse开发环境中使用maven插件的配置备忘

都是现成的东西了,但突然要建新的开发环境,一下子想不起来要去翻书,很耗时间。现将eclipse开发环境中maven的配置要点记录如下,以备不时之需。      m2eclipse插件可以在e...
  • eddyx
  • eddyx
  • 2011-10-11 09:36
  • 928

搭建Python的Eclipse开发环境之安装PyDev插件

使用update site安装pydev插件 注意:该安装指南针对eclipse 3.5和3.6 点击菜单‘Help > Install New Software...',打开Eclipse更新管...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)