`

Cannot delete or update a parent row: a foreign key constraint fails的思考

 
阅读更多

1.假设Group实体对应着多个User实体


2.假设Group没有对userList设置级联删除


3.当删除Group实体对象则出错:

com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails


4当删除Group实体对象时,需要先把Group下的所有User干掉,然后再把Group干掉


5.over

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics