`
Althars
  • 浏览: 75967 次
  • 性别: Icon_minigender_1
  • 来自: 成都
文章分类
社区版块
存档分类

iBATOR (abator)自动代码生成工具

阅读更多

Introduction to iBATOR

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 will generate:

  • 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.

iBATOR is currently under development. The legacy version (Abator) is still available. If you have suggestions for the future of iBATOR, please feel free to send them to the Java user's mailing list..

About the Name

iBATOR is an iBATIS stylized version of the English word "abator". Abator means "one who abates a nuisance".

iBATOR News

(April 14, 2008) Due to a trade registration dispute, Abator is renamed to iBATOR. iBATOR is currently under development. The initial source code drop can be checked out from SVN at http://svn.apache.org/repos/asf/ibatis/trunk/java/tools/ibator/

(March 20, 2008) Updated Abator and the Eclipse plugin to version 1.1.0. This is an extensive update that includes quite a few minor enhancements, two major enhancements (two new methods can be generated), and a few bug fixes. See the What's New? section of the online documentation for full details.

(August 20, 2006) Updated Abator and the Eclipse plugin to version 1.0.0. This is an extensive update that includes many new features including the ability to generate code for Java 5, generate different types of domain models, and hugely improved "by example" methods. See the "What's New?" section of the online documentation for full details.

iBATOR Development

iBATOR is currently under development. iBATOR will not be 100% compatible with Abator, but will be very close. Known differences include:

  • iBATOR requires JRE version 5.0 or higher
  • iBATOR generates code that depends on iBATIS version 2.2.0 or higher
  • iBATOR does not include the Legacy generator set from Abator
  • The format of the XML configuration file is slightly different and abator* elements are renamed to ibator*.
    The code generated by iBATOR will be 100% compatible with code generated by Abator. We are simply taking this opportunity to clean up some of the API that is a little cumbersome.

Legacy Abator Software Downloads and Documentation

Download the standalone JAR if you are using an IDE other than Eclipse. The standalone JAR includes an Ant task to run Abator, or you can run Abator from the command line of from Java code.

  • Abator 1.1.0 w/Binaries and Source

Documentation for the core functions of Abator is available online. This documentation set is also included in the downloads, and is integrated into the Eclipse help system if you are using the Eclipse plugin.

Documentation for the Eclipse specific features is integrated into the Eclipse help system and is not available online.

  • Abator Documentation

Eclipse Plugin

When run as an Eclipse plugin, Abator will persist the generated Java classes and SqlMap files in Eclipse projects. Abator can be run iteratively multiple time as the database design matures - and any hand coded additions to generated Java classes or SqlMap files will remain undisturbed.

Documentation for Abator is integrated into the Eclipse help system.

Requirements

  • Eclipse 3.2 or higher (Note: if you are stuck on Eclipse 3.0, or version 6.0 of the Rational development tools, the prior version of the plugin is still available on the update site)
  • JDK 1.4 or Higher

Automatic Eclipse Install

If you've already installed a prior version of Abator, simply run the Eclipse Install/Update tool and the new version will be found automatically.

If you've not already installed Abator, then you can use the built in Eclipse install support by following these steps:

  1. Take the "Help>Software Updates>Find and Install" Menu Option
  2. Select the "Search for new features to install" radio button, press "Next"
  3. Press the "New Remote Site" button
  4. Enter the following information: Name:Abator for Eclipse Update SiteURL:http://ibatis.apache.org/tools/abator
  5. Press OK
  6. Check the box next to "Abator for Eclipse Update Site"
  7. Follow the remainder of the install wizard

Manual Eclipse Install

The automatic install is much preferred, but you can also install Abator manually if you desire. To install manually, download the file AbatorForEclipse1.1.0.zip and unzip the file to some convenient location. After unzipping the update site archive, follow these steps in Eclipse:

  1. Take the "Help>Software Updates>Find and Install" Menu Option
  2. Select the "Search for new features to install" radio button, press "Next"
  3. Press the "New Local Site" button
  4. Navigate to the location where you unzipped the file.
  5. Press OK
  6. Follow the remainder of the install wizard

配置文件abatorConfig.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>    <!-- TODO: Add Database Connection Information -->
    <jdbcConnection driverClass="oracle.jdbc.driver.OracleDriver"
        connectionURL="jdbc:oracle:thin:@192.168.0.17:1521/fcg"
        userId="fcg"
        password="fcg">
      <classPathEntry location="E:\Tomcat6.0\lib\ojdbc14-10.2.0.1.0.jar" />
    </jdbcConnection>

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

    <!--
    <javaModelGenerator targetPackage="abator" targetProject="FCG\test">
      <property name="enableSubPackages" value="true" />
      <property name="trimStrings" value="true" />
    </javaModelGenerator>

    <sqlMapGenerator targetPackage="abator"  targetProject="FCG\test">
      <property name="enableSubPackages" value="true" />
    </sqlMapGenerator>

    <daoGenerator type="SPRING" targetPackage="abator"  targetProject="FCG\test">
      <property name="enableSubPackages" value="true" />
    </daoGenerator>

    <table schema="fcg" tableName="users" domainObjectName="User" >
       <property name="useActualColumnNames" value="true"/>    
     
      <generatedKey column="ID" sqlStatement="DB2" identity="true" />
      <columnOverride column="DATE_FIELD" property="startDate" />
      <ignoreColumn column="FRED" />
      <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" />
    </table>-->
    <!--  -->
    <javaModelGenerator targetPackage="abator" targetProject="FCG\test" />   
      <sqlMapGenerator targetPackage="abator" targetProject="FCG\test" />   
    <daoGenerator type="SPRING" targetPackage="abator" targetProject="FCG\test" />  
     <!--
    <table tableName="USERS" />   
    <table tableName="COMPONENTS" />   
    <table tableName="ROLES" /> 
    <table tableName="RESOURCES" />-->
    <table tableName="import_railroad_fee_check" />
  </abatorContext>
</abatorConfiguration>

1下载插件for eclipse

2将配置文件放入src根目录

3更改数据库路径,ojbdc路径

4在test目录下建立abator目录

5 tableName修改为需要自动生成代码的表名

6 在配置文件上右键,会出现生成代码的选项

评论

相关推荐

    ibatis:使用ibator自动生成代码和配置文件

    "ibatis:使用ibator自动生成代码和配置文件"这个主题聚焦于一个实用的工具——ibator,它是MyBatis框架的一个扩展,用于自动化MyBatis的代码生成过程。这篇文章将深入探讨ibator的工作原理、如何安装和配置,以及它...

    ibatis自动生成工具ibator及配置文件示例

    标题 "ibatis自动生成工具ibator及配置文件示例" 提到的是关于iBatis的自动化工具ibator的使用和配置。iBatis是一个优秀的Java持久层框架,它允许开发者将SQL语句直接写在XML配置文件中,使得数据库操作与业务逻辑...

    postgre自动生成代码

    在“Postgre自动生成代码”这个场景下,我们可以利用如iBator(逆向工程工具,是MyBatis的前身)或者MyBatis Generator这样的工具。这些工具能够通过读取数据库的表结构信息,自动创建对应的Java实体类(Entity)、...

    iBATOR-V1.1.0

    iBATOR,全称为"IBATIS Auto ...总的来说,iBATOR是iBATIS框架的有力辅助工具,通过自动化的代码生成,减少了开发者重复的工作,提升了开发效率。了解并熟练使用iBATOR,能够更好地发挥iBATIS的优势,优化开发流程。

    IBATOR动态生成sql和DAO层

    【IBATOR动态生成SQL和DAO层】是一种高效开发工具,基于Apache的iBatis框架,旨在简化数据库操作的代码编写工作。iBatis是Java语言中的一个持久层框架,它允许开发者将SQL语句直接嵌入到Java代码中,提供灵活的数据...

    ibator1.2.1

    而Ibator,作为Ibatis的一员,是其提供的一款自动化代码生成工具,极大地提升了开发效率,减轻了开发者的工作负担。本文将详细介绍Ibator 1.2.1这一版本的功能、使用方法以及在实际开发中的应用。 一、Ibator简介 ...

    ibator1.2.1配置文件

    Ibator是iBATIS(现在已经演变为MyBatis)的一个扩展,它能够根据数据库表结构自动生成Java源代码,包括DTO(Data Transfer Objects)、DAO(Data Access Object)类以及对应的XML映射文件,大大减少了手动编写这些...

    IBATIS3代码生成器

    【描述】"ibatis"是早期的名称,后来演进为"Ibator",再到最后的"Abator",这都是同一款代码生成工具的不同版本。IBATIS3代码生成器是其在IBATIS3框架下的一个分支,它利用XML配置文件和XSLT样式表来转换数据库元...

    ibator_3.0.6.full mybatis 代码生成器插件.zip

    首先,ibator是一个基于Mybatis的代码生成工具,它可以自动生成Java实体类、Mapper接口和XML配置文件,极大地提高了开发效率。在本例中,我们关注的是"ibator_3.0.6.full mybatis 代码生成器插件.zip"这个压缩包,它...

    ibatis2代码生成工具(生成实体Bean,Dao,SqlMap)

    6. **代码生成器(Code Generator)**:iBatis提供了代码生成工具ibator,它可以自动生成基于数据库表的Bean、Dao和SqlMap文件,极大地提高了开发效率。ibator可以根据配置文件自动读取数据库中的表结构,然后生成...

    ibatis自动生成工具ibator,改进版

    开源ibator什么xml和pojo的时候,经常会带一些讨厌的注释还有一些没用的ibatorgenerator等的,我改了它的源代码,弄了个干净的ibator

    为 Ibatis 2.3.4 构建增强的 Apache Ibator 实体类生成工具

    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 ...

    ibator 1.2.1

    【ibator 1.2.1】是一款基于Eclipse的插件,用于自动化生成Ibatis框架的代码。这个工具极大地提升了开发效率,减少了手动编写SQL映射文件、实体类和DAO层代码的工作量。它的核心功能是根据数据库表结构自动生成Java...

    ibator使用指导

    Ibator,全称是"iBatis Auto Generator",是一个强大的代码生成工具,用于简化基于MyBatis框架的数据库模型、映射文件和DAO接口的创建。在MyEclipse 7.5中安装Ibator插件可以极大提高开发效率,避免手动编写重复的...

    dao自动生成工具 基于ibator 只需要设置少量参数就能 创建dao层所有类

    ibator-huoniao通过它你可以通过配置少量参数,通过一键生成dao层的全部文件,能够应付对dao层的所有操作 产物包括: 1. pojo文件 2. dao接口类 3. dao接口实现类文件 4. ibatis sql map文件 5. 数据库查询时...

    Ibator参考程序

    Ibator,全称“Introspected Table Abstraction”,是Apache MyBatis框架的一个子项目,它提供了一个代码生成器,能够自动生成JavaBean、Mapper接口和XML配置文件,大大减少了开发者手动编写这些重复代码的工作量。...

    IBatis_Generator_Eclipse_1.2.1.zip

    ibatis ibator eclipes插件 代码生成器 代码自动生成工具 下载后将features和plugins两个文件夹下的文件拷贝到eclipes安装路径下对应的features和plugins两个文件夹下即可

    eclipse集成的ibator插件

    总之,Eclipse集成的Ibator插件是MyBatis开发不可或缺的工具,它通过图形化界面和自动化代码生成,极大地提高了开发效率,减少了手动编写持久层代码的工作量,使开发者能够更专注于业务逻辑的实现。

    ibator使用心得

    相较于Hibernate,ibator允许开发者拥有更多的SQL控制权,可以在生成的基础代码上自由定制SQL语句,同时又具备自动化管理数据库映射的优势。对于大型项目而言,ibator能够显著提高开发效率,减少重复工作,使开发者...

    ibator的eclipse插件

    `ibator`(IntelliJ IDEA的iBATIS Generator的Eclipse版本)是一款强大的数据库代码自动生成工具,它能够帮助开发者快速地生成Java持久层代码,包括实体类、Mapper接口及XML配置文件等,大大提高了开发效率。...

Global site tag (gtag.js) - Google Analytics