首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

!Hibernate事务与saveOfUpdate冲突

2012-02-16 
求救!Hibernate事务与saveOfUpdate冲突a different object with the same identifier value was already a

求救!Hibernate事务与saveOfUpdate冲突
a different object with the same identifier value was already associated with the session: [com.sie.gqgx.model.CompanyChangeLogMid#1640016]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.sie.gqgx.model.CompanyChangeLogMid#1640016]


利用spring 配置业务层的事务时,同个方法中多次调用了saveOfUpdate方法时就会报错。
利用了merge()的方法之后在方法调用完后又会报事务回滚的错!

[解决办法]
为了解决session关闭的问题,spring提供了opsessionviewfilter。去web。xml添加以下这个过滤器

热点排行