NonUniqueObjectException

 

添加刪除能用,修改報錯。java

exception:spring

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

 

方法:清除sessionide

 

 

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


}
 
相關文章
相關標籤/搜索