org.springframework.dao.DuplicateKeyException

org.springframework.dao.DuplicateKeyException: a different object with the same identifier value was already associated with the session: [cn.honry.base.bean.model.DrugStorage#402880a45437a18e015437b564c30050]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [cn.honry.base.bean.model.DrugStorage#402880a45437a18e015437b564c30050]

 

 

项目的用的是SSH ,数据库层继承的是spring提供的扩展hibernate的一个API-GenericDaoHibernate类
报了一个这个错误,虽然很快就查出了问题,但也记录下,以后碰到就省去了debug吧.
这个问题的话原因是在调用持久层类的进行保存域更新的时候,主键或唯一性约束冲突了.
posted @ 2016-05-04 10:28  微软小菜鸟  阅读(1684)  评论(0编辑  收藏  举报