# MyBatis Generator Quick Start Guide

To get up and running quickly with MyBatis Generator (MBG), follow these steps:

1. Create and fill out a configuration file appropriately. At a minimum, you must specify:
   1. A `<jdbcConnection>` element to specify how to connect to the target database
   2. A `<javaModelGenerator>` element to specify target package and target project for generated Java model objects
   3. A `<sqlMapGenerator>` element to specify target package and target project for generated SQL map files
   4. (Optionally) A `<javaClientGenerator>` element to specify target package and target project for generated client interfaces and classes (you may omit the `<javaClientGenerator>` element if you don't wish to generate Java client code)
   5. At least one database `<table>` element

   See the XML Configuration File Reference page for an example of a configuration file.

2. Save the file in some convenient location (like \temp\generatorConfig.xml)
3. Run MBG from the command line with a command like this:

             java -jar mybatis-generator-core-x.x.x.jar -configfile \temp\generatorConfig.xml -overwrite

   This will tell MBG to run using your configuration file. It will also tell MBG to overwrite any existing Java files with the same name. If you want to save any existing Java files, then omit the `-overwrite` parameter. If there is a conflict, MBG will save the newly generated file with a unique name (e.g. MyClass.java.1).

4. After running MBG, you will need to create or modify the standard MyBatis or iBATIS configuration files to make use of your newly generated code. See the Tasks After Running MyBatis Generator page for more information.

Important: Generated code for iBATIS2 requires that statement namespaces are enabled in your iBATIS configuration. See the Tasks After Running MyBatis Generator page for more information.