org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.xie.hibernate.modal.Org#2]
非唯一对象异常,这是因为:在hibernate实体类中加上了@GeneratedValue,同时还在生成对象时手动给id赋值,在向数据哭中存放数据记录时,就发生了这个异常。手动给id赋值,而hibernate又自动生成了id,产生冲突。解决办法:不要手动赋值id就可以了。