Caused by: java.sql.BatchUpdateException: Duplicate entry '' for key 'index_code'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.mysql.cj.util.Util.handleNewInstance(Util.java:192)
at com.mysql.cj.util.Util.getInstance(Util.java:167)
at com.mysql.cj.util.Util.getInstance(Util.java:174)
at com.mysql.cj.jdbc.exceptions.SQLError.createBatchUpdateException(SQLError.java:224)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchSerially(ClientPreparedStatement.java:853)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeBatchInternal(ClientPreparedStatement.java:435)
at com.mysql.cj.jdbc.StatementImpl.executeBatch(StatementImpl.java:796)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeBatch(DruidPooledPreparedStatement.java:565)
at io.seata.rm.datasource.StatementProxy.lambda$executeBatch$9(StatementProxy.java:129)
at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:73)
at io.seata.rm.datasource.exec.ExecuteTemplate.execute(ExecuteTemplate.java:51)
at io.seata.rm.datasource.StatementProxy.executeBatch(StatementProxy.java:129)
at com.baomidou.mybatisplus.core.executor.MybatisBatchExecutor.doFlushStatements(MybatisBatchExecutor.java:133)
at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:129)
at org.apache.ibatis.executor.BaseExecutor.flushStatements(BaseExecutor.java:122)
at org.apache.ibatis.session.defaults.DefaultSqlSession.flushStatements(DefaultSqlSession.java:252)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.lambda$executeBatch$3(ServiceImpl.java:258)
at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.executeBatch(ServiceImpl.java:222)
以我这个为准
就是因为加了个唯一索引code
版权声明:本文为qq_44221093原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。