Adrninistrator / java-all-call-graph

Generate all call graph for Java Code.
Apache License 2.0
437 stars 111 forks source link

帮忙看下写数据库问题org.springframework.dao.DuplicateKeyException #50

Open wzybupt opened 1 year ago

wzybupt commented 1 year ago

大佬你好,我这边使用demo,替换成我的jar包之后,把batchinsert的数量设置成1,报了下面这个错误,看不出来是什么原因,麻烦帮忙看下。

2023-10-13 17:01:24.638 [jacg_worker-2] ERROR DbOperator.batchInsert(291) - error sql: [insert into jacg_method_arg_generics_type_test_rbc(record_id, method_hash, simple_class_name, arg_seq, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?, ?)] 数据: [631, IgSN408-lXOijAIq-nPndw==#0a3, MessageLoader$Factory, 2, gt, 0, String, java.lang.String, xxx$Factory:create(java.lang.String,java.util.List,java.util.List,kotlin.jvm.functions.Function2)] org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [insert into jacg_method_arg_generics_type_test_rbc(record_id, method_hash, simple_class_name, arg_seq, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?, ?)]; Unique index or primary key violation: "jacg.uni_magt_mh_test_rbc_INDEX_5 ON jacg.jacg_method_arg_generics_type_test_rbc(method_hash NULLS FIRST, arg_seq NULLS FIRST, type NULLS FIRST, type_seq NULLS FIRST) VALUES ( / key:623 / 'IgSN408-lXOijAIq-nPndw==#0a3', CAST(2 AS TINYINT), 'gt', CAST(0 AS TINYINT))"; SQL statement: insert into jacg_method_arg_generics_type_test_rbc(record_id, method_hash, simple_class_name, arg_seq, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]; nested exception is org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "jacg.uni_magt_mh_test_rbc_INDEX_5 ON jacg.jacg_method_arg_generics_type_test_rbc(method_hash NULLS FIRST, arg_seq NULLS FIRST, type NULLS FIRST, type_seq NULLS FIRST) VALUES ( / key:623 / 'IgSN408-lXOijAIq-nPndw==#0a3', CAST(2 AS TINYINT), 'gt', CAST(0 AS TINYINT))"; SQL statement: insert into jacg_method_arg_generics_type_test_rbc(record_id, method_hash, simple_class_name, arg_seq, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1541) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:667) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:691) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:1034) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:1088) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:1079) ~[spring-jdbc-5.3.26.jar:5.3.26] at com.adrninistrator.jacg.dboper.DbOperator.batchInsert(DbOperator.java:285) ~[main/:?] at com.adrninistrator.jacg.handler.write_db.AbstractWriteDbHandler.lambda$insertDb$0(AbstractWriteDbHandler.java:333) ~[main/:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_361] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_361] at java.lang.Thread.run(Thread.java:750) [?:1.8.0_361] Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "jacg.uni_magt_mh_test_rbc_INDEX_5 ON jacg.jacg_method_arg_generics_type_test_rbc(method_hash NULLS FIRST, arg_seq NULLS FIRST, type NULLS FIRST, type_seq NULLS FIRST) VALUES ( / key:623 / 'IgSN408-lXOijAIq-nPndw==#0a3', CAST(2 AS TINYINT), 'gt', CAST(0 AS TINYINT))"; SQL statement: insert into jacg_method_arg_generics_type_test_rbc(record_id, method_hash, simple_class_name, arg_seq, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214] at org.h2.message.DbException.getJdbcSQLException(DbException.java:508) ~[h2-2.1.214.jar:2.1.214] at org.h2.message.DbException.getJdbcSQLException(DbException.java:477) ~[h2-2.1.214.jar:2.1.214] at org.h2.message.DbException.get(DbException.java:223) ~[h2-2.1.214.jar:2.1.214] at org.h2.message.DbException.get(DbException.java:199) ~[h2-2.1.214.jar:2.1.214] at org.h2.index.Index.getDuplicateKeyException(Index.java:525) ~[h2-2.1.214.jar:2.1.214] at org.h2.mvstore.db.MVSecondaryIndex.checkUnique(MVSecondaryIndex.java:223) ~[h2-2.1.214.jar:2.1.214] at org.h2.mvstore.db.MVSecondaryIndex.add(MVSecondaryIndex.java:184) ~[h2-2.1.214.jar:2.1.214] at org.h2.mvstore.db.MVTable.addRow(MVTable.java:519) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.dml.Insert.insertRows(Insert.java:174) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.dml.Insert.update(Insert.java:135) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.dml.DataChangeStatement.update(DataChangeStatement.java:74) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.CommandContainer.update(CommandContainer.java:169) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.Command.executeUpdate(Command.java:252) ~[h2-2.1.214.jar:2.1.214] at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:209) ~[h2-2.1.214.jar:2.1.214] at org.h2.jdbc.JdbcPreparedStatement.executeBatchElement(JdbcPreparedStatement.java:1317) ~[h2-2.1.214.jar:2.1.214] at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1263) ~[h2-2.1.214.jar:2.1.214] at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeBatch(DruidPooledPreparedStatement.java:551) ~[druid-1.2.15.jar:?] at org.springframework.jdbc.core.JdbcTemplate.lambda$batchUpdate$4(JdbcTemplate.java:1048) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:651) ~[spring-jdbc-5.3.26.jar:5.3.26] ... 9 more 2023-10-13 17:01:24.638 [jacg_worker-8] ERROR DbOperator.batchInsert(291) - error sql: [insert into jacg_method_arg_generics_type_test_rbc(record_id, method_hash, simple_class_name, arg_seq, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?, ?)] 数据: [628, IgSN408-lXOijAIq-nPndw==#0a3, MessageLoader$Factory, 1, t, 0, List, java.util.List, xxx$Factory:create(java.lang.String,java.util.List,java.util.List,kotlin.jvm.functions.Function2)] org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [insert into jacg_method_arg_generics_type_test_rbc(record_id, method_hash, simple_class_name, arg_seq, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?, ?)]; Unique index or primary key violation: "jacg.uni_magt_mh_test_rbc_INDEX_5 ON jacg.jacg_method_arg_generics_type_test_rbc(method_hash NULLS FIRST, arg_seq NULLS FIRST, type NULLS FIRST, type_seq NULLS FIRST) VALUES ( / key:620 / 'IgSN408-lXOijAIq-nPndw==#0a3', CAST(1 AS TINYINT), 't', CAST(0 AS TINYINT))"; SQL statement: insert into jacg_method_arg_generics_type_test_rbc(record_id, method_hash, simple_class_name, arg_seq, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214]; nested exception is org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "jacg.uni_magt_mh_test_rbc_INDEX_5 ON jacg.jacg_method_arg_generics_type_test_rbc(method_hash NULLS FIRST, arg_seq NULLS FIRST, type NULLS FIRST, type_seq NULLS FIRST) VALUES ( / key:620 / 'IgSN408-lXOijAIq-nPndw==#0a3', CAST(1 AS TINYINT), 't', CAST(0 AS TINYINT))"; SQL statement: insert into jacg_method_arg_generics_type_test_rbc(record_id, method_hash, simple_class_name, arg_seq, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247) ~[spring-jdbc-5.3.26.jar:5.3.26] ingframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1541) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:667) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:691) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:1034) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:1088) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:1079) ~[spring-jdbc-5.3.26.jar:5.3.26] at com.adrninistrator.jacg.dboper.DbOperator.batchInsert(DbOperator.java:285) ~[main/:?] at com.adrninistrator.jacg.handler.write_db.AbstractWriteDbHandler.lambda$insertDb$0(AbstractWriteDbHandler.java:333) ~[main/:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_361] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_361] at java.lang.Thread.run(Thread.java:750) [?:1.8.0_361] Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "jacg.uni_magt_mh_test_rbc_INDEX_5 ON jacg.jacg_method_arg_generics_type_test_rbc(method_hash NULLS FIRST, arg_seq NULLS FIRST, type NULLS FIRST, type_seq NULLS FIRST) VALUES ( / key:620 / 'IgSN408-lXOijAIq-nPndw==#0a3', CAST(1 AS TINYINT), 't', CAST(0 AS TINYINT))"; SQL statement: insert into jacg_method_arg_generics_type_test_rbc(record_id, method_hash, simple_class_name, arg_seq, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-214] at org.h2.message.DbException.getJdbcSQLException(DbException.java:508) ~[h2-2.1.214.jar:2.1.214] at org.h2.message.DbException.getJdbcSQLException(DbException.java:477) ~[h2-2.1.214.jar:2.1.214] at org.h2.message.DbException.get(DbException.java:223) ~[h2-2.1.214.jar:2.1.214] at org.h2.message.DbException.get(DbException.java:199) ~[h2-2.1.214.jar:2.1.214] at org.h2.index.Index.getDuplicateKeyException(Index.java:525) ~[h2-2.1.214.jar:2.1.214] at org.h2.mvstore.db.MVSecondaryIndex.checkUnique(MVSecondaryIndex.java:223) ~[h2-2.1.214.jar:2.1.214] at org.h2.mvstore.db.MVSecondaryIndex.add(MVSecondaryIndex.java:184) ~[h2-2.1.214.jar:2.1.214] at org.h2.mvstore.db.MVTable.addRow(MVTable.java:519) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.dml.Insert.insertRows(Insert.java:174) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.dml.Insert.update(Insert.java:135) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.dml.DataChangeStatement.update(DataChangeStatement.java:74) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.CommandContainer.update(CommandContainer.java:169) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.Command.executeUpdate(Command.java:252) ~[h2-2.1.214.jar:2.1.214] at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:209) ~[h2-2.1.214.jar:2.1.214] at org.h2.jdbc.JdbcPreparedStatement.executeBatchElement(JdbcPreparedStatement.java:1317) ~[h2-2.1.214.jar:2.1.214] at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1263) ~[h2-2.1.214.jar:2.1.214] at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeBatch(DruidPooledPreparedStatement.java:551) ~[druid-1.2.15.jar:?] at org.springframework.jdbc.core.JdbcTemplate.lambda$batchUpdate$4(JdbcTemplate.java:1048) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:651) ~[spring-jdbc-5.3.26.jar:5.3.26] ... 9 more

还有几个其他的warning, test.call_graph.extend_complex.TestExtendComplex 类的构造函数解析后 superClassA1 非静态字段可能的类型数量大于1 test.call_graph.extend_complex.ChildClassA1 test.call_graph.extend_complex.ChildClassA2 eee 以下类获取到的字段的Spring Bean类型与字段类型不匹配 test.call_graph.spring.bean.use.wrong_name.TestSpringWrongNameService1 springWrongNameService2 test.call_graph.spring.bean.define.wrong_name.SpringWrongNameService2 test.call_graph.spring.bean.define.wrong_name.SpringWrongNameService1

无法找到bootstrapMethod的方法信息 xxx.DBRecoverPreference BootstrapMethod(33, 1, [26])

无法找到bootstrapMethod的方法信息 xxx.MessageLoader$Companion BootstrapMethod(60, 1, [53])

出现方法名+参数类型均相同的方法,但方法没有ACC_BRIDGE标志,与预期不符 xxx.MessageLoader$Factory create(java.lang.String,java.util.List,java.util.List,kotlin.jvm.functions.Function2)

无法找到bootstrapMethod的方法信息 xxr.MessageLoader$Factory BootstrapMethod(190, 1, [183])

不知道有没有关系。

或者还需要什么信息,请告知我,我尽快提供。

Adrninistrator commented 1 year ago

其他的错误提示不用管 插入数据库失败的,需要看一下生成的method_arg_generics_type文件,找一下以下的记录,是不是有出现多行

IgSN408-lXOijAIq-nPndw==#0a3, MessageLoader$Factory, 2, gt, 0, String, java.lang.String, xxx$Factory:create(java.lang.String,java.util.List,java.util.List,kotlin.jvm.functions.Function2)
IgSN408-lXOijAIq-nPndw==#0a3, MessageLoader$Factory, 1, t, 0, List, java.util.List, xxx$Factory:create(java.lang.String,java.util.List,java.util.List,kotlin.jvm.functions.Function2)

如果是的话,先看一下这个类是不是在jar包里存在多个同名类,如果不是的话,麻烦发一下这个方法定义的代码,或者把class文件发过来一下

wzybupt commented 1 year ago

我这边稍微看了一下,看起来是不是跟我的文件时kotlin语言编译出来的原因。

这边会为kotlin的变量自动生成get方法,跟定义的其他get方法的名字冲突了,出现方法名+参数类型均相同的方法,但方法没有ACC_BRIDGE标志,与预期不符 xxx.MessageLoader$Factory create(java.lang.String,java.util.List,java.util.List,kotlin.jvm.functions.Function2)。我这边还发现了几个类,都报这个错误,然后在写入的时候报错。

jar包里面应该是没有同名类的,然后db里面也没有多行相同的。

比如我新运行的这个类, 2023-10-16 12:22:04.388 [jacg_worker-3] ERROR DbOperator.batchInsert(293) - error 为了打印插入失败的数据,可将_jacg_config/config.properties db.insert.batch.size参数值设置为1 sql: [insert into jacg_method_return_generics_type_test_rbc(record_id, method_hash, simple_class_name, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?)] org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [insert into jacg_method_return_generics_type_test_rbc(record_id, method_hash, simple_class_name, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?)]; Unique index or primary key violation: "jacg.uni_mrgt_mh_test_rbc_INDEX_7 ON jacg.jacg_method_return_generics_type_test_rbc(method_hash NULLS FIRST, type NULLS FIRST, type_seq NULLS FIRST) VALUES ( / key:2109 / 'cDPeRVi2x3j6GVboNaC1xw==#059', 't', CAST(0 AS TINYINT))"; SQL statement: insert into jacg_method_return_generics_type_test_rbc(record_id, method_hash, simple_class_name, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?) [23505-214]; nested exception is org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "jacg.uni_mrgt_mh_test_rbc_INDEX_7 ON jacg.jacg_method_return_generics_type_test_rbc(method_hash NULLS FIRST, type NULLS FIRST, type_seq NULLS FIRST) VALUES ( / key:2109 / 'cDPeRVi2x3j6GVboNaC1xw==#059', 't', CAST(0 AS TINYINT))"; SQL statement: insert into jacg_method_return_generics_type_test_rbc(record_id, method_hash, simple_class_name, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?) [23505-214] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1541) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:667) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:691) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:1034) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:1088) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.batchUpdate(JdbcTemplate.java:1079) ~[spring-jdbc-5.3.26.jar:5.3.26] at com.adrninistrator.jacg.dboper.DbOperator.batchInsert(DbOperator.java:285) ~[main/:?] at com.adrninistrator.jacg.handler.write_db.AbstractWriteDbHandler.lambda$insertDb$0(AbstractWriteDbHandler.java:333) ~[main/:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_361] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_361] at java.lang.Thread.run(Thread.java:750) [?:1.8.0_361] Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "jacg.uni_mrgt_mh_test_rbc_INDEX_7 ON jacg.jacg_method_return_generics_type_test_rbc(method_hash NULLS FIRST, type NULLS FIRST, type_seq NULLS FIRST) VALUES ( / key:2109 / 'cDPeRVi2x3j6GVboNaC1xw==#059', 't', CAST(0 AS TINYINT))"; SQL statement: insert into jacg_method_return_generics_type_test_rbc(record_id, method_hash, simple_class_name, type, type_seq, simple_generics_type, generics_type, full_method) values (?, ?, ?, ?, ?, ?, ?, ?) [23505-214] at org.h2.message.DbException.getJdbcSQLException(DbException.java:508) ~[h2-2.1.214.jar:2.1.214] at org.h2.message.DbException.getJdbcSQLException(DbException.java:477) ~[h2-2.1.214.jar:2.1.214] at org.h2.message.DbException.get(DbException.java:223) ~[h2-2.1.214.jar:2.1.214] at org.h2.message.DbException.get(DbException.java:199) ~[h2-2.1.214.jar:2.1.214] at org.h2.index.Index.getDuplicateKeyException(Index.java:525) ~[h2-2.1.214.jar:2.1.214] at org.h2.mvstore.db.MVSecondaryIndex.checkUnique(MVSecondaryIndex.java:223) ~[h2-2.1.214.jar:2.1.214] at org.h2.mvstore.db.MVSecondaryIndex.add(MVSecondaryIndex.java:184) ~[h2-2.1.214.jar:2.1.214] at org.h2.mvstore.db.MVTable.addRow(MVTable.java:519) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.dml.Insert.insertRows(Insert.java:174) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.dml.Insert.update(Insert.java:135) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.dml.DataChangeStatement.update(DataChangeStatement.java:74) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.CommandContainer.update(CommandContainer.java:169) ~[h2-2.1.214.jar:2.1.214] at org.h2.command.Command.executeUpdate(Command.java:252) ~[h2-2.1.214.jar:2.1.214] at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:209) ~[h2-2.1.214.jar:2.1.214] at org.h2.jdbc.JdbcPreparedStatement.executeBatchElement(JdbcPreparedStatement.java:1317) ~[h2-2.1.214.jar:2.1.214] at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1263) ~[h2-2.1.214.jar:2.1.214] at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeBatch(DruidPooledPreparedStatement.java:551) ~[druid-1.2.15.jar:?] at org.springframework.jdbc.core.JdbcTemplate.lambda$batchUpdate$4(JdbcTemplate.java:1048) ~[spring-jdbc-5.3.26.jar:5.3.26] at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:651) ~[spring-jdbc-5.3.26.jar:5.3.26] ... 9 more

image 我从数据库看应该没有重复的东西,但是就是报错。

我把这个类和之前类的class文件都一起附上,麻烦帮忙看看什么原因。

wzybupt commented 1 year ago

messagetabRepo.zip messageLoader.zip 已上传,麻烦看下哈~

Adrninistrator commented 1 year ago

好的,晚上我看一下,如果重复的内容是一样的,我就改一个新版本,让插入的时候不报错

wzybupt commented 1 year ago

嗯嗯,麻烦您了,我其实还是没搞明白为什么报错,我看那个sql,是通过几个字段组合起来,来判断是否唯一的,我看数据库里面的数据组合起来都是唯一的,可能重复的那条没写进去。

Adrninistrator commented 1 year ago

提交了一个版本,1.0.13,把两个数据库表的唯一索引先改成普通索引了,这样数据可以正常写到数据库里 可能会导致上面的两个方法识别成一个方法,主要是现在没有把方法返回类型当作方法唯一标识的一部分导致的 长期解决的话会麻烦一点,目前的处理方式大部分场景下应该也不会有问题

Adrninistrator commented 1 year ago

提交了一个版本,1.0.13,把两个数据库表的唯一索引先改成普通索引了,这样数据可以正常写到数据库里 可能会导致上面的两个方法识别成一个方法,主要是现在没有把方法返回类型当作方法唯一标识的一部分导致的 长期解决的话会麻烦一点,目前的处理方式大部分场景下应该也不会有问题

easonzheng @.***

 

wzybupt commented 1 year ago

好了,可以跑通了。我是用源码跑的,但是我只改了一个sql,少改了一个sql···