Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[错误报告]: DataChangeRecorderInnerInterceptor 在进行新旧数据比对时,updateValue 转 Comparable 时抛出异常。 #6562

Open
3 tasks done
musicguoke opened this issue Oct 29, 2024 · 0 comments

Comments

@musicguoke
Copy link

确认

  • 我使用的版本是最新版, 并且使用插件确认过项目里无依赖版本冲突
  • 我已经在 issue 中搜索过, 确认问题没有被提出过
  • 我已经修改标题, 将标题中的 描述 替换为遇到的问题

当前程序版本

3.5.7

问题描述

DataChangeRecorderInnerInterceptor 中的 DataColumnChangeResult#isDataChanged 方法内,将 originalValueupdateValue 进行比对判断其是否变化时,当 updateValue 没有实现 Comparable 相关接口导致类型转换失败。
例如:
updateValue 类型为 Jackson中的 JsonNode 时。

详细堆栈日志

java.lang.ClassCastException: class com.fasterxml.jackson.databind.node.ObjectNode cannot be cast to class java.lang.Comparable (com.fasterxml.jackson.databind.node.ObjectNode is in unnamed module of loader 'app'; java.lang.Comparable is in module java.base of loader 'bootstrap')
	at com.baomidou.mybatisplus.extension.plugins.inner.DataChangeRecorderInnerInterceptor$DataColumnChangeResult.isDataChanged(DataChangeRecorderInnerInterceptor.java:873) ~[classes/:na]
	at com.baomidou.mybatisplus.extension.plugins.inner.DataChangeRecorderInnerInterceptor$DataChangedRecord.hasUpdate(DataChangeRecorderInnerInterceptor.java:952) ~[classes/:na]
	at com.baomidou.mybatisplus.extension.plugins.inner.DataChangeRecorderInnerInterceptor.compareAndGetUpdatedColumnDatas(DataChangeRecorderInnerInterceptor.java:386) ~[classes/:na]
	at com.baomidou.mybatisplus.extension.plugins.inner.DataChangeRecorderInnerInterceptor.processUpdate(DataChangeRecorderInnerInterceptor.java:249) ~[classes/:na]
	at com.baomidou.mybatisplus.extension.plugins.inner.DataChangeRecorderInnerInterceptor.beforePrepare(DataChangeRecorderInnerInterceptor.java:153) ~[classes/:na]
	at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:102) ~[mybatis-plus-extension-3.5.7.jar:3.5.7]
	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:59) ~[mybatis-3.5.16.jar:3.5.16]
	at jdk.proxy2/jdk.proxy2.$Proxy124.prepare(Unknown Source) ~[na:na]
	at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:90) ~[mybatis-3.5.16.jar:3.5.16]
	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49) ~[mybatis-3.5.16.jar:3.5.16]
	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) ~[mybatis-3.5.16.jar:3.5.16]
	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) ~[mybatis-3.5.16.jar:3.5.16]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:61) ~[mybatis-3.5.16.jar:3.5.16]
	at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:106) ~[mybatis-plus-extension-3.5.7.jar:3.5.7]
	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:59) ~[mybatis-3.5.16.jar:3.5.16]
	at jdk.proxy2/jdk.proxy2.$Proxy123.update(Unknown Source) ~[na:na]
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197) ~[mybatis-3.5.16.jar:3.5.16]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:425) ~[mybatis-spring-3.0.3.jar:3.0.3]
	at jdk.proxy2/jdk.proxy2.$Proxy89.update(Unknown Source) ~[na:na]
	at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:288) ~[mybatis-spring-3.0.3.jar:3.0.3]
	at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:64) ~[mybatis-plus-core-3.5.7.jar:3.5.7]
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:152) ~[mybatis-plus-core-3.5.7.jar:3.5.7]
	at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89) ~[mybatis-plus-core-3.5.7.jar:3.5.7]
	at jdk.proxy3/jdk.proxy3.$Proxy112.updateById(Unknown Source) ~[na:na]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant