1. 程式人生 > >Hibernate經典異常:org.hibernate.NonUniqueObjectException: a different object with the same identifier

Hibernate經典異常:org.hibernate.NonUniqueObjectException: a different object with the same identifier

最近在用Hibernate做資料修改和刪除的時候,遇到一個Hibernate的經典異常之一:

看了將近兩天的各種部落格、論壇,花費了大量的精力嘗試了 session.evict()、session.clear()、session.merge()等部落格、論壇上的數種方法以及自己的各種猜想以及方法以後。。。。。。。。。

終於。。。。。還是回到了原點!!!

還是一樣的:org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 

讓人非常鬱悶!!!我也無能為力了,只能後面再慢慢測試了。

各位大佬有先見之明的希望提點提點我。