mybatis写入数据库时,出现insert(Unknown Source)问题,常见的原因

 

问题分析:

1.首先检测mapper类中的方法参数类型是否一致;

2.检测一下mapper.xml文件中的参数名称是否一直?

例如:

 

eg:实体类中varCode与.xml中的varcode不一致,会抛出insert(Unknown Source)异常。

 

转载于:https://www.cnblogs.com/myworldfordata/p/8496767.html

### Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time (seg0 192.124.44.133:40000 pid=4124623) Hint: Ensure that no rows proposed for insertion within the same command have duplicate constrained values. ### The error may exist in file [/home/dexcloud/vd-config/conf/mapping/SoftwareProcessApdb.xml] ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: INSERT INTO vd.software_dict ( software_name, process_name, software_type, os_type, active, create_time, update_time ) VALUES ### Cause: org.postgresql.util.PSQLException: ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time (seg0 192.124.44.133:40000 pid=4124623) Hint: Ensure that no rows proposed for insertion within the same command have duplicate constrained values. ; ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time (seg0 192.124.44.133:40000 pid=4124623) Hint: Ensure that no rows proposed for insertion within the same command have duplicate constrained values.; nested exception is org.postgresql.util.PSQLException: ERROR: ON CONFLICT D Hint: Ensure that no rows proposed for insertion within the same command have duplicate constrained values. at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:244) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:91) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441) at com.sun.proxy.$Proxy199.insert(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272) at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) at com.sun.proxy.$Proxy267.batchInsertSoftwareProcess(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:503) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
最新发布
03-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值