今天执行删除的时候无论如何也删不掉
句子没问题什么都好好的
然后发现是因为有外键无法删除
解决办法就是删除外键或者使用连并删除语句
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`student`.`score`, CONSTRAINT `fk_score_student` FOREIGN KEY (`student_id`) REFERENCES `student` (`sid`))
### The error may exist in StudentMapper.xml
### The error may involve StudentMapper.delete-Inline
### The error occurred while setting parameters
### SQL: DELETE FROM student WHERE sid=?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`student`.`score`, CONSTRAINT `fk_score_student` FOREIGN KEY (`student_id`) REFERENCES `student` (`sid`))
foreign key constraint fails (
student
.
score
, CONSTRAINT
fk_score_student
FOREIGN KEY (
student_id
) REFERENCES
student
版权声明:本文为m0_49194578原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。