添加删除能用,修改报错。
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