首页 > 数据库技术 > 详细

java.sql.SQLIntegrityConstraintViolationException: ORA-00001: 违反唯一约束条件

时间:2020-02-27 11:48:21      阅读:343      评论:0      收藏:0      [点我收藏+]

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加密后的字符串,,加入时间和其他一些独有信息生成主键更不容易重复哦!

java.sql.SQLIntegrityConstraintViolationException: ORA-00001: 违反唯一约束条件

原文:https://www.cnblogs.com/name-lizonglin/p/12370734.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!