当前使用版本(必填,否则不予处理)
3.5.3.2
该问题是如何引起的?(确定最新版也有问题再提!!!)
从3.5.3.1升级到3.5.3.2之后
重现步骤(如果有就写完整)
只是mybatis-plus包版本升级,为了使用BaseMapper的新方法,其他没有任何变化
感觉是在找updateById方法的mybatis定义,这个是mybatis-plus的BaseMapper方法,不知道哪里的问题。
报错信息
Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for <应用Mapper类名,省略>.updateById
Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for <应用Mapper类名,省略>.updateById
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for <应用Mapper类名,省略>.updateById
Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for <应用Mapper类名,省略>.updateById
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:97)
at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.executeBatch(SqlHelper.java:200)
at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.executeBatch(SqlHelper.java:231)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.executeBatch(ServiceImpl.java:250)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.updateBatchById(ServiceImpl.java:200)
at com.baomidou.mybatisplus.extension.service.IService.updateBatchById(IService.java:265)
at com.baomidou.mybatisplus.extension.service.IService$$FastClassBySpringCGLIB$$f8525d18.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:283)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
at <应用Service类名,省略>$$EnhancerBySpringCGLIB$$b201fce1.updateBatchById(<generated>)
at com.baomidou.mybatisplus.extension.service.IService$$FastClassBySpringCGLIB$$f8525d18.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:283)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
at <应用包名,省略>$$EnhancerBySpringCGLIB$$d604baa8.updateBatchById(<generated>)
Comment From: shlijun
Error updating database. Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.smcv.salesOrder.center.dao.owdol.base.TtCtmLimitMapper.updateById
Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for <应用Mapper类名,省略>.updateById
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:199)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.lambda$updateBatchById$3(ServiceImpl.java:203)
at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.lambda$executeBatch$1(SqlHelper.java:236)
at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.executeBatch(SqlHelper.java:190)
... 143 common frames omitted
Caused by: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for <应用Mapper类名,省略>.updateById at com.baomidou.mybatisplus.core.MybatisConfiguration$StrictMap.get(MybatisConfiguration.java:454) at com.baomidou.mybatisplus.core.MybatisConfiguration.getMappedStatement(MybatisConfiguration.java:353) at com.baomidou.mybatisplus.core.MybatisConfiguration.getMappedStatement(MybatisConfiguration.java:345) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:196) ... 146 common frames omitted
Comment From: nieqiurong
这个堆栈日志不好确认问题,提供一个复现工程或者你断点在sql注入器上看看注入方法有无该mapper注入.
Comment From: shlijun
这个堆栈日志不好确认问题,提供一个复现工程或者你断点在sql注入器上看看注入方法有无该mapper注入.
复现工程我后续想办法试着弄一个吧,目前在项目中发现,源码不好给出来。
updateBatchById 这个方法是定义在mybatisplus的ServiceImpl中的,我的应用调用这个方法,在3.5.3.1下正常的,不知道升级之后哪里出了问题。
我先试着通过DefaultSqlInjector这个SQL注入器来查查看,多谢。
Comment From: shlijun
奇怪的是,直接调用<应用Mapper类名,省略>实例的updateById,是正常的。怀疑是新版本对Service的配置有变化
Comment From: nieqiurong
奇怪的是,直接调用<应用Mapper类名,省略>实例的updateById,是正常的。怀疑是新版本对Service的配置有变化
多SqlSessionFactory项目???
Comment From: shlijun
奇怪的是,直接调用<应用Mapper类名,省略>实例的updateById,是正常的。怀疑是新版本对Service的配置有变化
多SqlSessionFactory项目???
是的,多数据源项目,不同数据源使用不同的SqlSessionFactory实例。
刚刚查到3.5.3.2版本ServiceImpl中只使用默认的SqlSessionFactory,这个好像应用层改不了。
Comment From: shlijun
谢谢,等3.5.4发布
Comment From: nieqiurong
谢谢,等3.5.4发布
用3.5.4-SNAPSHOT试试看看.
Comment From: shlijun
升级到3.5.4之后还是不行:
java.lang.ClassCastException: org.springframework.aop.framework.JdkDynamicAopProxy cannot be cast to com.baomidou.mybatisplus.core.override.MybatisMapperProxy
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.getSqlSessionFactory(ServiceImpl.java:90)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.executeBatch(ServiceImpl.java:271)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.updateBatchById(ServiceImpl.java:221)
at com.baomidou.mybatisplus.extension.service.IService.updateBatchById(IService.java:265)
at com.baomidou.mybatisplus.extension.service.IService$$FastClassBySpringCGLIB$$f8525d18.invoke(
Comment From: nieqiurong
升级到3.5.4之后还是不行: java.lang.ClassCastException: org.springframework.aop.framework.JdkDynamicAopProxy cannot be cast to com.baomidou.mybatisplus.core.override.MybatisMapperProxy at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.getSqlSessionFactory(ServiceImpl.java:90) at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.executeBatch(ServiceImpl.java:271) at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.updateBatchById(ServiceImpl.java:221) at com.baomidou.mybatisplus.extension.service.IService.updateBatchById(IService.java:265) at com.baomidou.mybatisplus.extension.service.IService$$FastClassBySpringCGLIB$$f8525d18.invoke()
AOP问题 #5741