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加密后的字符串,,加入時間和其他一些獨有信息生成主鍵更不容易重復哦!