Introduction to MyBatis Generator

MyBatis Generator (MBG) is a code generator for MyBatis MyBatis and iBATIS. It will generate code for all versions of MyBatis, and versions of iBATIS after version 2.2.0. It will introspect a database table (or many tables) and will generate artifacts that can be used to access the table(s). This lessens the initial nuisance of setting up objects and configuration files to interact with database tables. MBG 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 join queries, or stored procedures.

MyBatis Generator will generate:

MyBatis generator is designed to run well in an iterative development environment, and can be included as an Ant task, or a Maven plugin, in a continuous build environment. Important things to note when running MBG iteratively include:

  1. MBG will automatically merge XML files if there is an existing file with the same name as the newly generated XML file. MBG will not overwrite any custom changes you make to the XML files it generates. You can run it over and over again without fear of losing custom changes to you XML. MBG will replace any XML elements that were generated in a previous run.
  2. MBG will not merge Java files, it can either overwrite existing files or save newly generated files with a different unique name. If you make changes to the generated Java files and run MBG iteratively you will have to merge the changes by hand. When run as an Eclipse plugin, then MBG can automatically merge Java files.

Dependencies

MBG has no dependencies beyond the JRE. JRE 5.0 or above is required. Also, a JDBC driver that implements the DatabaseMetaData interface, especially the getColumns and getPrimaryKeys methods is required.

Support

Support for MyBatis Generator is provided through the MyBatis user mailing list. You may subscribe to or view the mailing list through Google code here:

http://groups.google.com/group/mybatis-user

If you think you have found a bug, please ask a question about it on the user list first, before creating a new ticket. If you find a bug, or have a new feature request, you may open a new issue at the google code project here:

http://code.google.com/p/mybatis/