NonUniqueObjectException
代碼和老師寫的一樣,出現了這個錯誤
Exception in thread "main" org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [entity.Student#0]
代碼和老師寫的一樣,出現了這個錯誤
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的主鍵生成策略設成increament就好了。原因是sid(int型)沒有傳值,默認為零。同時存倆次就會報錯