我的解決方案,關於a different object with the same identifier value was already associated with the session

a different object with the same identifier value was already associated with the session: [cn.itcast.entity.Manager#4]

這個很是讓人頭疼,搞了好久,百度了好多,我沒用上,可能知識有限,但我有我的解決方案,多加一行代碼! 感覺很搞笑...

ssh中 更新管理員和樓棟信息時(多對一映射),只有更改樓棟信息,才讓我保存數據,只更改管理員信息,就報錯!先保存管理員信息,然後再保存樓棟信息。

我先把代碼貼上來!

ManagerAction:

buildings實體:

buildings.hbm.xml

Manager實體:

Manager.hbm.xml

重點就是第一張圖中的那一行代碼,感覺自己很搞笑!!

能力有限,只能這麼做了。。。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章