NonUniqueObjectException

添加删除能用,修改报错。

exception:

org.springframework.orm.hibernate3.HibernateSystemException: a different object with the same identifier value was already associated with the session: [com.accp.oa.entity.Userinfo#qqqq]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.accp.oa.entity.Userinfo#qqqq]

方法:清除session

public class Userinfo_Dao_Impl extends HibernateDaoSupport implements Userinfo_Dao {

	/**
	 * @param userinfo
	 * 更新用户信息
	 */
	public void updateUser(Userinfo userinfo){
		this.getHibernateTemplate().getSessionFactory().getCurrentSession().clear();
		this.getHibernateTemplate().update(userinfo);
	}


}
 
扫描二维码关注公众号,回复: 6551510 查看本文章

转载于:https://my.oschina.net/u/2260184/blog/540562

猜你喜欢

转载自blog.csdn.net/weixin_34351321/article/details/92186242
今日推荐