向Orcale中Users表插入数据出现如下错误:
————————
HTTP Status 500 – Internal Server Error
Type Exception ReportMessage Request processing failed; nested exception is org.springframework.dao.DuplicateKeyException:
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DuplicateKeyException:
Error updating database. Cause: java.sql.SQLException: ORA-00001: 违反唯一约束条件 (SSM.SYS_C005426)
The error may involve com.alibaba.ssm.dao.UserDao.save-Inline
The error occurred while setting parameters
SQL: insert into users(email, username, password, phoneNum, status) values(?, ?, ?, ?, ?)
Cause: java.sql.SQLException: ORA-00001: 违反唯一约束条件 (SSM.SYS_C005426)
; ]; ORA-00001: 违反唯一约束条件 (SSM.SYS_C005426)
; nested exception is java.sql.SQLException: ORA-00001: 违反唯一约束条件 (SSM.SYS_C005426)
——————
查看表结构可以看出email字段有唯一属性:
————
所以添加数据时,email这个字段不能重复。