org.mybatis.generator.exception.XMLParserException Java Examples
The following examples show how to use
org.mybatis.generator.exception.XMLParserException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Generator.java From mybatis-action with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws IOException, XMLParserException, InvalidConfigurationException, SQLException, InterruptedException { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; InputStream is = Generator.class.getResourceAsStream("/generator/generatorConfig.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration configuration = cp.parseConfiguration(is); is.close(); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(configuration, callback, warnings); myBatisGenerator.generate(null); for (String warning : warnings) { System.out.println(warning); } }
Example #2
Source File: MyBatisGeneratorConfigurationParser.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
public Configuration parseConfiguration(Element rootNode) throws XMLParserException { Configuration configuration = new Configuration(); NodeList nodeList = rootNode.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node childNode = nodeList.item(i); if (childNode.getNodeType() != Node.ELEMENT_NODE) { continue; } if ("properties".equals(childNode.getNodeName())) { //$NON-NLS-1$ parseProperties(configuration, childNode); } else if ("classPathEntry".equals(childNode.getNodeName())) { //$NON-NLS-1$ parseClassPathEntry(configuration, childNode); } else if ("context".equals(childNode.getNodeName())) { //$NON-NLS-1$ parseContext(configuration, childNode); } } return configuration; }
Example #3
Source File: MyBatisGeneratorConfigurationParser.java From mapper-generator-javafx with Apache License 2.0 | 6 votes |
public Configuration parseConfiguration(Element rootNode) throws XMLParserException { Configuration configuration = new Configuration(); NodeList nodeList = rootNode.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node childNode = nodeList.item(i); if (childNode.getNodeType() != Node.ELEMENT_NODE) { continue; } if ("properties".equals(childNode.getNodeName())) { parseProperties(childNode); } else if ("classPathEntry".equals(childNode.getNodeName())) { parseClassPathEntry(configuration, childNode); } else if ("context".equals(childNode.getNodeName())) { parseContext(configuration, childNode); } } return configuration; }
Example #4
Source File: IbatorConfigurationParser.java From mybatis-generator-plus with Apache License 2.0 | 6 votes |
public Configuration parseIbatorConfiguration(Element rootNode) throws XMLParserException { Configuration configuration = new Configuration(); NodeList nodeList = rootNode.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node childNode = nodeList.item(i); if (childNode.getNodeType() != Node.ELEMENT_NODE) { continue; } if ("properties".equals(childNode.getNodeName())) { //$NON-NLS-1$ parseProperties(configuration, childNode); } else if ("classPathEntry".equals(childNode.getNodeName())) { //$NON-NLS-1$ parseClassPathEntry(configuration, childNode); } else if ("ibatorContext".equals(childNode.getNodeName())) { //$NON-NLS-1$ parseIbatorContext(configuration, childNode); } } return configuration; }
Example #5
Source File: MyBatisGeneratorConfigurationParser.java From mybatis-generator-core-fix with Apache License 2.0 | 6 votes |
public Configuration parseConfiguration(Element rootNode) throws XMLParserException { Configuration configuration = new Configuration(); NodeList nodeList = rootNode.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node childNode = nodeList.item(i); if (childNode.getNodeType() != Node.ELEMENT_NODE) { continue; } if ("properties".equals(childNode.getNodeName())) { //$NON-NLS-1$ parseProperties(configuration, childNode); } else if ("classPathEntry".equals(childNode.getNodeName())) { //$NON-NLS-1$ parseClassPathEntry(configuration, childNode); } else if ("context".equals(childNode.getNodeName())) { //$NON-NLS-1$ parseContext(configuration, childNode); } } return configuration; }
Example #6
Source File: IbatorConfigurationParser.java From mybatis-generator-core-fix with Apache License 2.0 | 6 votes |
public Configuration parseIbatorConfiguration(Element rootNode) throws XMLParserException { Configuration configuration = new Configuration(); NodeList nodeList = rootNode.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node childNode = nodeList.item(i); if (childNode.getNodeType() != Node.ELEMENT_NODE) { continue; } if ("properties".equals(childNode.getNodeName())) { //$NON-NLS-1$ parseProperties(configuration, childNode); } else if ("classPathEntry".equals(childNode.getNodeName())) { //$NON-NLS-1$ parseClassPathEntry(configuration, childNode); } else if ("ibatorContext".equals(childNode.getNodeName())) { //$NON-NLS-1$ parseIbatorContext(configuration, childNode); } } return configuration; }
Example #7
Source File: MapperGeneratorStrategyBase.java From mapper-generator-javafx with Apache License 2.0 | 6 votes |
/** * 调用 mybatis-generator * * @param document xml */ protected void generateMyBatis3(Document document, GeneratorConfig generatorConfig) { List<String> warnings = new ArrayList<>(); ConfigurationParser cp = new ConfigurationParser(warnings); try { Configuration config = cp.parseConfiguration(document); MyShellCallback shellCallback = new MyShellCallback(true, generatorConfig.isUseMerge()); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, shellCallback, warnings); myBatisGenerator.generate(null, null, null); } catch (InvalidConfigurationException | XMLParserException | InterruptedException | IOException | SQLException e) { log.error("生成mapper error", e); throw new BizException("导出失败"); } if (!warnings.isEmpty()) { warnings.forEach(log::warn); } }
Example #8
Source File: SelectiveEnhancedPluginTest.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * 测试配置异常 */ @Test public void testWarnings() throws IOException, XMLParserException, InvalidConfigurationException, InterruptedException, SQLException { // 1. 没有配置ModelColumnPlugin插件 MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/SelectiveEnhancedPlugin/mybatis-generator-without-ModelColumnPlugin.xml"); tool.generate(); Assert.assertEquals(tool.getWarnings().get(0), "itfsw:插件com.itfsw.mybatis.generator.plugins.SelectiveEnhancedPlugin插件需配合com.itfsw.mybatis.generator.plugins.ModelColumnPlugin插件使用!"); }
Example #9
Source File: Generator.java From seata-samples with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws IOException, XMLParserException, InvalidConfigurationException, SQLException, InterruptedException { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; InputStream inputStream = Generator.class.getClassLoader().getResourceAsStream("config/generatorConfig.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(inputStream); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(new NullProgressCallback()); }
Example #10
Source File: MyBatisGeneratorTool.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * 创建 * @param resource * @return */ public static MyBatisGeneratorTool create(String resource) throws IOException, XMLParserException { MyBatisGeneratorTool tool = new MyBatisGeneratorTool(); tool.warnings = new ArrayList<>(); // MyBatisGenerator 创建 ConfigurationParser cp = new ConfigurationParser(tool.warnings); tool.config = cp.parseConfiguration(Resources.getResourceAsStream(resource)); // 修正配置目标 tool.fixConfigToTarget(); return tool; }
Example #11
Source File: TableRenamePluginTest.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * 测试提示信息 */ @Test public void testWarnings() throws IOException, XMLParserException, InvalidConfigurationException, InterruptedException, SQLException { // searchString、replaceString 单独配置 MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/TableRenamePlugin/mybatis-generator-with-wrong-properties.xml"); tool.generate(); Assert.assertEquals(tool.getWarnings().get(0), "itfsw:插件com.itfsw.mybatis.generator.plugins.TableRenamePlugin插件的searchString、replaceString属性需配合使用,不能单独存在!"); // 和官方domainObjectName或者mapperName一起配置 tool = MyBatisGeneratorTool.create("scripts/TableRenamePlugin/mybatis-generator-with-domainObject.xml"); tool.generate(); Assert.assertEquals(tool.getWarnings().get(0), "itfsw:插件com.itfsw.mybatis.generator.plugins.TableRenamePlugin插件请不要配合table的domainObjectName或者mapperName一起使用!"); }
Example #12
Source File: TableRenamePluginTest.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * 测试具体生成 */ @Test public void testGenerate() throws IOException, XMLParserException, InvalidConfigurationException, InterruptedException, SQLException { // 规则1 ^T 替换成 Test, 同时tb2 使用了tableOverride 替换成 TestOverride MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/TableRenamePlugin/mybatis-generator-rule1.xml"); MyBatisGenerator myBatisGenerator = tool.generate(); for (GeneratedJavaFile file : myBatisGenerator.getGeneratedJavaFiles()){ String name = file.getCompilationUnit().getType().getShortName(); if (name.matches(".*1.*")){ Assert.assertTrue(name.matches("Testb1.*")); } else { Assert.assertTrue(name.matches("TestOverride.*")); } } }
Example #13
Source File: TableRenamePluginTest.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * 测试替代 TablePrefixPlugin 插件 */ @Test public void testGenerateLikeTablePrefixPlugin() throws IOException, XMLParserException, InvalidConfigurationException, InterruptedException, SQLException { MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/TableRenamePlugin/mybatis-generator-like-TablePrefixPlugin.xml"); MyBatisGenerator myBatisGenerator = tool.generate(); for (GeneratedJavaFile file : myBatisGenerator.getGeneratedJavaFiles()){ String name = file.getCompilationUnit().getType().getShortName(); Assert.assertTrue(name.matches("DB1.*")); } }
Example #14
Source File: LimitPluginTest.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * 测试配置异常 */ @Test public void testWarnings() throws IOException, XMLParserException, InvalidConfigurationException, InterruptedException, SQLException { MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/LimitPlugin/mybatis-generator-with-error-driver.xml"); tool.generate(); Assert.assertEquals(tool.getWarnings().get(1), "itfsw:插件com.itfsw.mybatis.generator.plugins.LimitPlugin只支持MySQL数据库!"); }
Example #15
Source File: UpsertPluginTest.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * 测试配置异常 */ @Test public void testWarnings() throws IOException, XMLParserException, InvalidConfigurationException, InterruptedException, SQLException { // 1. 没有使用mysql数据库 MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/UpsertPlugin/mybatis-generator-with-error-driver.xml"); tool.generate(); Assert.assertEquals(tool.getWarnings().get(1), "itfsw:插件com.itfsw.mybatis.generator.plugins.UpsertPlugin插件使用前提是数据库为MySQL!"); // 2. 普通提示 tool = MyBatisGeneratorTool.create("scripts/UpsertPlugin/mybatis-generator.xml"); tool.generate(); Assert.assertEquals(tool.getWarnings().get(0), "itfsw:插件com.itfsw.mybatis.generator.plugins.UpsertPlugin插件您开启了allowMultiQueries支持,注意在jdbc url 配置中增加“allowMultiQueries=true”支持(不怎么建议使用该功能,开启多sql提交会增加sql注入的风险,请确保你所有sql都使用MyBatis书写,请不要使用statement进行sql提交)!"); }
Example #16
Source File: GeneratorMain.java From spring-boot-starter-dao with Apache License 2.0 | 5 votes |
private void generate(Properties properties)throws IOException, XMLParserException, SQLException, InterruptedException, InvalidConfigurationException { ClassPathResource resource = new ClassPathResource("META-INF/generator/generatorconfig.xml"); List<String> warnings = new ArrayList<String>(); ConfigurationParser cp = new ConfigurationParser(properties, warnings); Configuration config = cp.parseConfiguration(resource.getInputStream()); System.err.println("#############################################################################################"); System.err.println("######################################开始生成##################################################"); System.err.println("#############################################################################################"); new MyBatisGenerator(config, new DefaultShellCallback(true), warnings).generate(new VerboseProgressCallback()); System.err.println("#############################################################################################"); System.err.println("#######################################生成完毕#################################################"); System.err.println("#############################################################################################"); }
Example #17
Source File: MybatisGenerator.java From spring-tutorial with Creative Commons Attribution Share Alike 4.0 International | 5 votes |
public static void main(String[] args) throws IOException, XMLParserException, InvalidConfigurationException, SQLException, InterruptedException { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File configFile = new File( "D:\\01_workspace\\Project\\zp\\java\\spring-tutorial\\codes\\data\\orm\\src\\main\\resources\\mybatis\\generatorConfig.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(null); }
Example #18
Source File: LogicalDeletePluginTest.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * 测试配置异常 */ @Test public void testWarnings() throws IOException, XMLParserException, InvalidConfigurationException, InterruptedException, SQLException { // 1. 不支持的类型 MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/LogicalDeletePlugin/mybatis-generator-with-unsupport-type.xml"); tool.generate(); Assert.assertEquals(tool.getWarnings().get(0), "itfsw(逻辑删除插件):tb逻辑删除列(ts_2)的类型不在支持范围(请使用数字列,字符串列,布尔列)!"); // 2. 没有找到配置的逻辑删除列 tool = MyBatisGeneratorTool.create("scripts/LogicalDeletePlugin/mybatis-generator-with-unfind-column.xml"); tool.generate(); Assert.assertEquals(tool.getWarnings().get(0), "itfsw(逻辑删除插件):tb没有找到您配置的逻辑删除列(ts_999)!"); // 3. 没有配置逻辑删除值 tool = MyBatisGeneratorTool.create("scripts/LogicalDeletePlugin/mybatis-generator-with-unconfig-logicalDeleteValue.xml"); tool.generate(); Assert.assertEquals(tool.getWarnings().get(0), "itfsw(逻辑删除插件):tb没有找到您配置的逻辑删除值,请全局或者局部配置logicalDeleteValue和logicalUnDeleteValue值!"); // 4. 保留关键词冲突 tool = MyBatisGeneratorTool.create("scripts/LogicalDeletePlugin/mybatis-generator-with-keywords.xml"); tool.generate(); Assert.assertEquals(tool.getWarnings().get(0), "itfsw(逻辑删除插件):tb配置的逻辑删除列和插件保留关键字(andLogicalDeleted)冲突!"); }
Example #19
Source File: TablePrefixPluginTest.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * 测试具体生成 */ @Test public void testGenerate() throws IOException, XMLParserException, InvalidConfigurationException, InterruptedException, SQLException { // 全局规则增加 DB, tb2 单独规则增加Tt MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/TablePrefixPlugin/mybatis-generator.xml"); MyBatisGenerator myBatisGenerator = tool.generate(); for (GeneratedJavaFile file : myBatisGenerator.getGeneratedJavaFiles()){ String name = file.getCompilationUnit().getType().getShortName(); if (name.matches(".*1.*")){ Assert.assertTrue(name.matches("DB.*")); } else { Assert.assertTrue(name.matches("Tt.*")); } } }
Example #20
Source File: TablePrefixPluginTest.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * 测试提示信息 */ @Test public void testWarnings() throws IOException, XMLParserException, InvalidConfigurationException, InterruptedException, SQLException { // 和官方domainObjectName或者mapperName一起配置 MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/TablePrefixPlugin/mybatis-generator-with-domainObject.xml"); tool.generate(); Assert.assertEquals(tool.getWarnings().get(0), "itfsw:插件com.itfsw.mybatis.generator.plugins.TablePrefixPlugin插件请不要配合table的domainObjectName或者mapperName一起使用!"); }
Example #21
Source File: GeneratorTest.java From ManagementSystem with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws IOException, XMLParserException, InvalidConfigurationException, SQLException, InterruptedException { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File configFile = new File("generatorConfig.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(null); }
Example #22
Source File: MybatisGenerator.java From ssm with Apache License 2.0 | 5 votes |
private static void generator() throws IOException, XMLParserException, InvalidConfigurationException, SQLException, InterruptedException { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; File configFile = new File(MybatisGenerator.class.getClass().getResource("/").getPath()+ "config/generator-config.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(null); }
Example #23
Source File: ExampleTargetPluginTest.java From mybatis-generator-plugin with Apache License 2.0 | 5 votes |
/** * 测试异常配置 */ @Test public void testWarnings() throws IOException, XMLParserException, InvalidConfigurationException, InterruptedException, SQLException { MyBatisGeneratorTool tool = MyBatisGeneratorTool.create("scripts/ExampleTargetPlugin/mybatis-generator-without-target.xml"); tool.generate(); Assert.assertEquals(tool.getWarnings().get(0), "请配置com.itfsw.mybatis.generator.plugins.ExampleTargetPlugin插件的目标包名(targetPackage)!"); }
Example #24
Source File: Generator.java From seata-samples with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws IOException, XMLParserException, InvalidConfigurationException, SQLException, InterruptedException { List<String> warnings = new ArrayList<String>(); boolean overwrite = true; InputStream inputStream = Generator.class.getClassLoader().getResourceAsStream("config/generatorConfig.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(inputStream); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(new NullProgressCallback()); }
Example #25
Source File: ConfigurationParser.java From mybatis-generator-plus with Apache License 2.0 | 4 votes |
private Configuration parseMyBatisGeneratorConfiguration(Element rootNode) throws XMLParserException { MyBatisGeneratorConfigurationParser parser = new MyBatisGeneratorConfigurationParser( properties); return parser.parseConfiguration(rootNode); }
Example #26
Source File: ConfigurationParser.java From mybatis-generator-plus with Apache License 2.0 | 4 votes |
private Configuration parseIbatorConfiguration(Element rootNode) throws XMLParserException { IbatorConfigurationParser parser = new IbatorConfigurationParser( properties); return parser.parseIbatorConfiguration(rootNode); }
Example #27
Source File: ConfigurationParser.java From mybatis-generator-core-fix with Apache License 2.0 | 4 votes |
private Configuration parseMyBatisGeneratorConfiguration(Element rootNode) throws XMLParserException { MyBatisGeneratorConfigurationParser parser = new MyBatisGeneratorConfigurationParser( properties); return parser.parseConfiguration(rootNode); }
Example #28
Source File: ConfigurationParser.java From mybatis-generator-core-fix with Apache License 2.0 | 4 votes |
private Configuration parseIbatorConfiguration(Element rootNode) throws XMLParserException { IbatorConfigurationParser parser = new IbatorConfigurationParser( properties); return parser.parseIbatorConfiguration(rootNode); }
Example #29
Source File: GenService.java From MybatisGenerator-UI with MIT License | 4 votes |
public String genCode(HttpServletRequest request) { String ip = request.getParameter("ip"); String db = request.getParameter("db"); String port = request.getParameter("port"); String userName = request.getParameter("username"); String password = request.getParameter("password"); String modelPackageName = request.getParameter("modelpackagename"); String daoPackageName = request.getParameter("daopackagename"); String mapperPath = request.getParameter("mapperpath"); String tableNames[] = request.getParameterValues("tablenames"); String tableModels[] = request.getParameterValues("tablemodels"); String path = "mbg"; // 清空临时文件夹下所有内容 deleteDir(new File(System.getProperty("user.dir") + "/mbg")); try { List<String> warnings = new ArrayList<>(); boolean overwrite = true; File dirFile = new File(path); if (!dirFile.exists()) { dirFile.mkdirs(); } File conf = new File(System.getProperty("user.dir") + "/conf/Configuration.xml"); ConfigurationParser parser = new ConfigurationParser(warnings); Configuration config = parser.parseConfiguration(conf); Context context = config.getContexts().get(0); // db JDBCConnectionConfiguration jdbcConnectionConfiguration = context.getJdbcConnectionConfiguration(); String connection = "jdbc:mysql://" + ip + ":" + port + "/" + db; jdbcConnectionConfiguration.setConnectionURL(connection); jdbcConnectionConfiguration.setUserId(userName); jdbcConnectionConfiguration.setPassword(password); // model 配置 JavaModelGeneratorConfiguration javaModelGeneratorConfiguration = context.getJavaModelGeneratorConfiguration(); javaModelGeneratorConfiguration.setTargetPackage(modelPackageName); javaModelGeneratorConfiguration.setTargetProject(path); // DAO 配置 JavaClientGeneratorConfiguration javaClientGeneratorConfiguration = context.getJavaClientGeneratorConfiguration(); javaClientGeneratorConfiguration.setTargetPackage(daoPackageName); javaClientGeneratorConfiguration.setTargetProject(path); // Mapper SqlMapGeneratorConfiguration sqlMapGeneratorConfiguration = context.getSqlMapGeneratorConfiguration(); sqlMapGeneratorConfiguration.setTargetPackage(mapperPath); sqlMapGeneratorConfiguration.setTargetProject(path); // 表 List<TableConfiguration> tableConfigurations = context.getTableConfigurations(); tableConfigurations.clear(); for (int i = 0; i < tableNames.length; i++) { if (!tableNames[i].isEmpty() && !tableModels[i].isEmpty()) { TableConfiguration tableConfiguration = new TableConfiguration(context); tableConfiguration.setTableName(tableNames[i]); tableConfiguration.setDomainObjectName(tableModels[i]); tableConfiguration.setCountByExampleStatementEnabled(false); tableConfiguration.setDeleteByExampleStatementEnabled(false); tableConfiguration.setSelectByExampleStatementEnabled(false); tableConfiguration.setUpdateByExampleStatementEnabled(false); tableConfiguration.getProperties().setProperty("useActualColumnNames", "false"); tableConfigurations.add(tableConfiguration); } } DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(null); FileUtil.compress("mbg", System.getProperty("user.dir") + "/result/", "mbg.zip"); } catch (SQLException e) { e.printStackTrace(); return "01"; } catch (IOException ioe) { ioe.printStackTrace(); return "02"; } catch (InterruptedException ite) { ite.printStackTrace(); return "03"; } catch (InvalidConfigurationException ice) { ice.printStackTrace(); return "04"; } catch (XMLParserException xmle) { xmle.printStackTrace(); return "05"; } return "00"; }
Example #30
Source File: ConfigurationParser.java From mapper-generator-javafx with Apache License 2.0 | 4 votes |
private Configuration parseMyBatisGeneratorConfiguration(Element rootNode) throws XMLParserException { MyBatisGeneratorConfigurationParser parser = new MyBatisGeneratorConfigurationParser(extraProperties); return parser.parseConfiguration(rootNode); }