mybatis-plus报错内存溢出

版本 3.4.1

报错信息

Caused by: org.apache.ibatis.builder.BuilderException: Error evaluating expression 'ew.sqlSegment != null and ew.sqlSegment != '' and ew.nonEmptyOfWhere'. Cause: org.apache.ibatis.ognl.OgnlException: sqlSegment [java.lang.OutOfMemoryError: Java heap space]
	at org.apache.ibatis.scripting.xmltags.OgnlCache.getValue(OgnlCache.java:48)
	at org.apache.ibatis.scripting.xmltags.ExpressionEvaluator.evaluateBoolean(ExpressionEvaluator.java:32)
	at org.apache.ibatis.scripting.xmltags.IfSqlNode.apply(IfSqlNode.java:34)
	at org.apache.ibatis.scripting.xmltags.MixedSqlNode.lambda$apply$0(MixedSqlNode.java:32)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
	at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:32)
	at org.apache.ibatis.scripting.xmltags.TrimSqlNode.apply(TrimSqlNode.java:55)
	at org.apache.ibatis.scripting.xmltags.MixedSqlNode.lambda$apply$0(MixedSqlNode.java:32)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
	at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:32)
	at org.apache.ibatis.scripting.xmltags.IfSqlNode.apply(IfSqlNode.java:35)
	at org.apache.ibatis.scripting.xmltags.MixedSqlNode.lambda$apply$0(MixedSqlNode.java:32)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
	at org.apache.ibatis.scripting.xmltags.MixedSqlNode.apply(MixedSqlNode.java:32)
	at org.apache.ibatis.scripting.xmltags.DynamicSqlSource.getBoundSql(DynamicSqlSource.java:39)
	at org.apache.ibatis.mapping.MappedStatement.getBoundSql(MappedStatement.java:305)
	at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:53)
	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
	at com.sun.proxy.$Proxy316.query(Unknown Source)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
	at jdk.internal.reflect.GeneratedMethodAccessor410.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
	... 76 common frames omitted

更换版本

    
            
                com.baomidou
                mybatis-plus-generator
                3.5.0
            

            
            
            
                com.baomidou
                mybatis-plus-boot-starter
                3.5.0
            

代码生成工具类

package com.pojo.common.core.utils;

/**
 * Author:ZhuShangJin
 * Date:2018/6/12
 */


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.pojo.common.core.web.controller.BaseController;
import com.pojo.common.core.web.domain.BaseEntity;
import com.pojo.common.core.web.service.BaseService;
import com.pojo.common.core.web.service.impl.BaseServiceImpl;

/**
 * 

* 代码生成器演示 *

*/ public class MyBatisPlusGenerateUtil { /** * 数据源配置 */ private static final DataSourceConfig DATA_SOURCE_CONFIG = new DataSourceConfig .Builder("jdbc:mysql://xxx.xx.xx.xx:19306/yhpt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8", "root", "xxxxxx") .build(); /** *

* MySQL 生成演示 *

*/ public static void main(String[] args) { AutoGenerator generator = new AutoGenerator(DATA_SOURCE_CONFIG); generator.strategy(strategyConfig()); generator.global(globalConfig()); generator.packageInfo(packageConfig()); generator.template(templateConfig()); generator.execute(); } /** * 策略配置 */ protected static StrategyConfig strategyConfig() { return new StrategyConfig.Builder().addTablePrefix(new String[]{"prj_"}) .addInclude(new String[]{"prj_device_oper_history"}).entityBuilder() .superClass(BaseEntity.class) .enableChainModel() .enableLombok() .enableRemoveIsPrefix() .enableTableFieldAnnotation() .enableActiveRecord() .naming(NamingStrategy.underline_to_camel) .columnNaming(NamingStrategy.underline_to_camel) .addSuperEntityColumns("id", "create_by", "create_time", "update_by", "update_time") .idType(IdType.AUTO) .controllerBuilder() .superClass(BaseController.class) .enableHyphenStyle() .enableRestStyle() .serviceBuilder() .superServiceClass(BaseService.class) .superServiceImplClass(BaseServiceImpl.class) .formatServiceFileName("%sService") .formatServiceImplFileName("%sServiceImp") .mapperBuilder() .superClass(BaseMapper.class) .enableBaseResultMap() .enableBaseColumnList() .formatMapperFileName("%sMapper") .formatXmlFileName("%sXml") .build(); } /** * 全局配置 作者 输出目录 */ protected static GlobalConfig globalConfig() { return new GlobalConfig.Builder().author("zsj").fileOverride().outputDir("d://test").build(); } /** * 包配置 代码包名 */ protected static PackageConfig packageConfig() { return new PackageConfig.Builder().parent("com.pojo.prj") // .moduleName("device") .mapper("mapper") .xml("mapper.xml") .entity("domain") .build(); } /** * 模板配置 */ protected static TemplateConfig templateConfig() { return new TemplateConfig.Builder().entity("entity.java") .build(); } /** * 注入配置 */ protected static InjectionConfig.Builder injectionConfig() { // 测试自定义输出文件之前注入操作,该操作再执行生成代码前 debug 查看 return new InjectionConfig.Builder().beforeOutputFile((tableInfo, objectMap) -> { System.out.println("tableInfo: " + tableInfo.getEntityName() + " objectMap: " + objectMap.size()); }); } }

你可能感兴趣的:(mybatis)