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);
	}


}
 

 

 

 

 

 

 

 

你可能感兴趣的:(NonUniqueObjectException)