List<String> warnings = new ArrayList<String>();
boolean overwrite = true;
String genCfg = "generatorConfig.xml";
File configFile = new File(MyBatisGeneratorTool.class.getResource(
genCfg).getFile());
ConfigurationParser cp = new ConfigurationParser(warnings);
Configuration config = null;
try
{
System.out
.println("--------->>>Start to generate code....--------------------");
config = cp.parseConfiguration(configFile);
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
MyBatisGenerator myBatisGenerator = null;
myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
myBatisGenerator.generate(null);
System.out