Error setting non null for parameter #1 with JdbcType null . dm.jdbc.driver.DMException: 序列号无效

问题出现

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='__frch_item_0.batchId', mode=IN, javaType=class java.lang.Long, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: dm.jdbc.driver.DMException: 序列号无效
	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
	at com.sun.proxy.$Proxy134.insert(Unknown Source)
	at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:58)
	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
	at com.sun.proxy.$Proxy147.insertMonthAddDelList(Unknown Source)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
	at com.sun.proxy.$Proxy148.insertMonthAddDelList(Unknown Source)
	at cn.chinaunicom.modular.hr.reportcore.service.ReportPersonCoreService.createBenqiHTZAddDelPerson(ReportPersonCoreService.java:622)
	at cn.chinaunicom.modular.hr.reportcore.service.ReportPersonCoreService.createReportMonthPerson(ReportPersonCoreService.java:202)
	at cn.chinaunicom.modular.hr.reportcore.service.ReportPersonCoreService.createReportMonthAll(ReportPersonCoreService.java:75)
	at cn.chinaunicom.modular.hr.reportcore.service.ReportPersonCoreService$$FastClassBySpringCGLIB$$370f7d30.invoke(<generated>)
	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.aop.interceptor.AsyncExecutionInterceptor$1.call(AsyncExecutionInterceptor.java:115)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='__frch_item_0.batchId', mode=IN, javaType=class java.lang.Long, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: dm.jdbc.driver.DMException: 序列号无效
	at com.baomidou.mybatisplus.MybatisDefaultParameterHandler.setParameters(MybatisDefaultParameterHandler.java:276)
	at org.apache.ibatis.executor.statement.PreparedStatementHandler.parameterize(PreparedStatementHandler.java:93)
	at org.apache.ibatis.executor.statement.RoutingStatementHandler.parameterize(RoutingStatementHandler.java:64)
	at sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
	at com.sun.proxy.$Proxy307.parameterize(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
	at com.sun.proxy.$Proxy307.parameterize(Unknown Source)
	at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86)
	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)
	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
	... 26 more
Caused by: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: dm.jdbc.driver.DMException: 序列号无效
	at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:55)
	at com.baomidou.mybatisplus.MybatisDefaultParameterHandler.setParameters(MybatisDefaultParameterHandler.java:274)
	... 48 more
Caused by: dm.jdbc.driver.DMException: 序列号无效
	at dm.jdbc.driver.DBError.throwException(DBError.java:700)
	at dm.jdbc.driver.DmdbPreparedStatement.prepareBindInParam(DmdbPreparedStatement.java:567)
	at dm.jdbc.driver.DmdbPreparedStatement.do_setLong(DmdbPreparedStatement.java:656)
	at dm.jdbc.driver.DmdbPreparedStatement.setLong(DmdbPreparedStatement.java:1550)
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_setLong(FilterChainImpl.java:3313)
	at com.alibaba.druid.filter.FilterAdapter.preparedStatement_setLong(FilterAdapter.java:1266)
	at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_setLong(FilterChainImpl.java:3310)
	at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.setLong(PreparedStatementProxyImpl.java:395)
	at com.alibaba.druid.pool.DruidPooledPreparedStatement.setLong(DruidPooledPreparedStatement.java:325)
	at sun.reflect.GeneratedMethodAccessor215.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:67)
	at com.sun.proxy.$Proxy309.setLong(Unknown Source)
	at org.apache.ibatis.type.LongTypeHandler.setNonNullParameter(LongTypeHandler.java:31)
	at org.apache.ibatis.type.LongTypeHandler.setNonNullParameter(LongTypeHandler.java:26)
	at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:53)
	... 49 more
==> Parameters: 0(String), 507664(Long), org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='__frch_item_0.batchId', mode=IN, javaType=class java.lang.Long, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: dm.jdbc.driver.DMException: 序列号无效   at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)   at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)   at com.sun.proxy.$Proxy134.insert(Unknown Source)   at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)   at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:58)   at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)   at com.sun.proxy.$Proxy147.insertMonthAddDelList(Unknown Source)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)   at java.lang.reflect.Method.invoke(Method.java:498)   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)   at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)   at com.sun.proxy.$Proxy148.insertMonthAddDelList(Unknown Source)   at cn.chinaunicom.modular.hr.reportcore.service.ReportPersonCoreService.createBenqiHTZAddDelPerson(ReportPersonCoreService.java:622)   at cn.chinaunicom.modular.hr.reportcore.service.ReportPersonCoreService.createReportMonthPerson(ReportPersonCoreService.java:202)   at cn.chinaunicom.modular.hr.reportcore.service.ReportPersonCoreService.createReportMonthAll(ReportPersonCoreService.java:75)   at cn.chinaunicom.modular.hr.reportcore.service.ReportPersonCoreService$$FastClassBySpringCGLIB$$370f7d30.invoke(<generated>)   at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)   at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)   at org.springfram(String), 2023-10-19 09:29:42.468(Timestamp)

问题解析

天地良心,遇到这个问题,大部分的人反应肯定是要去看看是哪一个sql出现的问题
在这里插入图片描述
这是对应的代码,出现问题的地方在一个insert插入,一般来说肯定是怀疑是插入的问题,可能是dm数据库字段和Java字段不一致,可能是Java中没有加入主键自增的注释,这一块就是为了处理上个博客中出现的参数限制所写的。
小小的介绍一下项目背景,这个项目是一个整在运行的项目,不过他是由mysql运行的,现在改成dm数据库了,然后会可以保证的是里面的sql是可以运行的,所以说其实上述的问题都不存在,但是我确实没有想到,忙活了两天之后一点头绪都没有。
后来我单独写了一个接口调用,只穿一个对象,发现可以,这个时候还没有反应过来,后来想到不然我也在这个逻辑地方只穿一个或者使用其他循环方式都可以。
再后来才发现,就是他的参数处理不了那么多,所以才会提示这个!我修改了每次穿的数量就好了。

  • 7
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

又是重名了

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值