解决报错:a different object with the same identifier value was already associated with the session

亲测有效!!!
Hibernate的session中取值,重复取值,会导致session中有多条数据,会发生错误

解决方法:使用Hibernate的getSession()方法中的merge()方法中,会把重复的session数据清除只剩一条,并会存进数据库中

错误信息:
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session

你可能感兴趣的:(遇到的一些问题)