JPA Referential integrity constraint violation oneToMany and bulk manipulation query

 ̄綄美尐妖づ 提交于 2019-12-03 18:29:32

You're trying to delete all the students from the database before deleting the attendances. But attendance has a foreign key to student. So, if the database let you delete the students, you would have an incoherent database: attendances referencing students that don't exist.

So you must delete attendances before deleting students.

Note that the cascades existing between entities are irrelevant, because insert, update and delete queries completely ignore them.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!