天天看點

資料庫Hibernate 删除資料後出現錯誤

15-Mar-2018 20:47:57.547 INFO [http-nio-8087-exec-2] org.hibernate.event.internal.DefaultLoadEventListener.doOnLoad HHH000327: Error performing load command : org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [net.xlman.web.gotogether.bean.db.Group#814e091f-8bad-4fa1-8888-d97faf29420a]

查了百度發現是因為hibernate項目裡面配了很多many-to-one的關聯,背景在查詢資料時已經作了健全性判斷。産生錯誤的原因是你使用sql語句删除了某個表中的某條資料,結果在及健全性判斷的時候判斷其他表中有你删除的那條資料的關聯。

解決方法:删除掉所有關聯的資料

繼續閱讀