NonUniqueObjectException
代碼和老師寫的一樣,出現(xiàn)了這個錯誤
Exception in thread "main" org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [entity.Student#0]
代碼和老師寫的一樣,出現(xiàn)了這個錯誤
Exception in thread "main" org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [entity.Student#0]
2017-08-05
舉報
2017-08-26
Student.hbm.xml的主鍵生成策略設(shè)成increament就好了。原因是sid(int型)沒有傳值,默認(rèn)為零。同時存?zhèn)z次就會報錯