Build an enhanced Apache ibator entity class generation tool for ibatis 2.3.4

Source: Internet
Author: User
Introduction to ibator

Ibator is a code generator for ibatis. ibator will introspect a database table (or partition 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.

 

 

Apache ibatis has been migrated from the Apache Foundation to Google, ibatis has been upgraded from 2.3.4 to 3.0.1, and its name has been changed from "ibatis" to "mybatis ". However, the ibatis automated entity class generation tool ibator has not been updated so far. Because ibatis 2.3.4 was used in the previous project, and the new version of mybatis 3.0.1 has changed a lot, if you upgrade it, the previous program should be greatly adjusted.

 

Here we will share with you a previously modified ibator program and make many improvements:

 

  • Removed all useless "generated by Apache ibatis ibator" prompts in object classes and XML ing files.
  • Added the javaheadercomment and xmlheadercomment attributes to generate file headers (including copyrighted author information) in object classes and XML ing files)
  • Added the targetfileencoding property to output object classes and XML ing files in multiple formats, supporting: ASCII, UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, UTF-32LE
  • Added a $ {projectpath} variable to replace the path of the. jar file in the configuration file.
  • Added the datetimeformat, dateformat, and timeformat attributes to support custom Date and Time formats.
  • Change the format of the entity-class syntax scheme to the C ++ style (curly braces, spaces, and other display methods)
  • Added the set and get methods of the string parameter type for the field type Integer, floating point type, time date type, and blob type of the table. (by default, only parameters of the corresponding Java type are used, currently, you can directly input the string type, such as setsomeblobasstring. Here, someblob is the field type of Blob)
  • Is the example of the object class. added the andsomecolumnequalto, andsomecolumnnotequalto, expires, expires, andsomecolumnlessthan, expires, expires, and expires methods for the criteria class to overload functions with the same name, and added the string parameter type. Here the somecolumn is a field name
  • Added the countallrecord, deleteallrecord, and selectallrecord methods for entity classes Dao and XML ing files and SQL ing.
  • For more information, see the generated object class and XML ing file.
  •  

     

    : Http://download.csdn.net/source/2536605

     

     

     

    Note:

    1. Original ibatis 2.3.4 Official Website: http://ibatis.apache.org

    2, the original ibator 1.2.1 official address: http://ibatis.apache.org/ibator.html

    3. New mybatis Official Website: http://www.mybatis.org/java.html

     

     

     

     

     

     

     

     

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.