美文网首页
mybatisGenerator的配置文件生成代码

mybatisGenerator的配置文件生成代码

作者: leimelon | 来源:发表于2020-03-26 16:23 被阅读0次

@Testpublic void test11(){

ArrayList<String> warings = new ArrayList<String>();

boolean overwrite=true;

String getConfig="/generatorConfig.xml";

File file = new File(test1.class.getResource(getConfig).getFile());

ConfigurationParser configurationParser = new ConfigurationParser(warings);

Configuration configuration=null;

try {

configuration = configurationParser.parseConfiguration(file);

} catch (IOException e) {

e.printStackTrace();

} catch (XMLParserException e) {

e.printStackTrace();

}

DefaultShellCallback defaultShellCallback = new DefaultShellCallback(overwrite);

MyBatisGenerator myBatisGenerator=null;

try {

myBatisGenerator = new MyBatisGenerator(configuration,defaultShellCallback,warings);

} catch (InvalidConfigurationException e) {

e.printStackTrace();

} try {

myBatisGenerator.generate(null);

} catch (SQLException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

} catch (InterruptedException e) {

e.printStackTrace();

}

}

相关文章

网友评论

      本文标题:mybatisGenerator的配置文件生成代码

      本文链接:https://www.haomeiwen.com/subject/oumcuhtx.html