Error setting non null for parameter #1 with JdbcType null . dm.jdbc.driver.DMException: Invalid sequence number

Problem occurred

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: The sequence number is invalid
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: Invalid sequence number
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: sequence Invalid number
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: Invalid serial number
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: Invalid sequence number 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(JdkDynamicAopPro xy.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(CglibAopProx y. java:738) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframe(String), 2023-10-19 09:29:42.468(Timestamp)

Problem analysis

Conscience of heaven and earth, when encountering this problem, most people’s reaction is to find out which sql is causing the problem.

This is the corresponding code. The problem occurs in an insert. Generally speaking, it is definitely suspected to be an insertion problem. It may be that the dm database field and the Java field are inconsistent. It may be that the primary key auto-increment comment is not added to Java. This section It was written to deal with the parameter restrictions that appeared in the previous blog.
Let me briefly introduce the background of the project. This project is a running project, but it is run by mysql. Now it is changed to a dm database. Then it can be guaranteed that the sql inside can be run, so in fact None of the above problems exist, but I really didn’t expect it. After two days of busy work, I have no clue.
Later, I wrote a separate interface call to only pass through one object, and found that it was OK. I didn’t react at this time. Later, I thought that I could also pass through only one object in this logical place or use other looping methods.
It was only later that I discovered that his parameters could not handle that many, so this was the prompt! I just changed the quantity for each wear and it was fine.