Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: 违反唯一约束条件 (JDDS.PK_SHOP_MESSAGE)
### The error may involve com.shop.dao.itf.MessageMapper.insert-Inline
### The error occurred while setting parameters
### SQL: insert into SHOP_MESSAGE (MESSAGE_ID)  values (?)
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: 违反唯一约束条件 (JDDS.PK_SHOP_MESSAGE)
; SQL []; ORA-00001: 违反唯一约束条件 (JDDS.PK_SHOP_MESSAGE)
; nested exception is java.sql.SQLIntegrityConstraintViolationException: ORA-00001: 违反唯一约束条件 (JDDS.PK_SHOP_MESSAGE)

 

因为表中主键字段一般都设置了唯一约束条件,插入时与已有数据主键字段相同时就会产生错误信息。

解决方法:主键的内容不要设置太简单,比如可以用MD5加密后的字符串,,加入时间和其他一些独有信息生成主键更不容易重复哦!

相关文章:

  • 2022-12-23
  • 2021-09-01
  • 2021-05-26
  • 2021-05-27
  • 2022-12-23
  • 2021-11-02
  • 2022-01-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2021-08-04
  • 2022-02-11
相关资源
相似解决方案