INFO com.c35.paris.dao.impl.UserDAOImpl.modifyById(UserDAOImpl.java:114) - modifyById method is running!
ERROR com.c35.paris.dao.impl.UserDAOImpl.modifyById(UserDAOImpl.java:121) - org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.c35.paris.vo.User#8aa3b3671d8ebd4c011d8ec457980003]
org.hibernate.HibernateException: 修改数据出错!a different object with the same identifier value was already associated with the session: [com.c35.paris.vo.User#8aa3b3671d8ebd4c011d8ec457980003]
[b]问题补充:[/b]
INFO com.c35.paris.dao.impl.UserDAOImpl.modifyById(UserDAOImpl.java:114) - modifyById method is running!
ERROR com.c35.paris.dao.impl.UserDAOImpl.modifyById(UserDAOImpl.java:121) - org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.c35.paris.vo.User#8aa3b3671d8ebd4c011d8ec457980003]
org.hibernate.HibernateException: 修改数据出错!a different object with the same identifier value was already associated with the session: [com.c35.paris.vo.User#8aa3b3671d8ebd4c011d8ec457980003]
怎么修改,
是下面的方法错了么?
public boolean modifyById(String id, Object o)throws Exception {
boolean flag=false;
log.info("modifyById method is running!");
Transaction tran = null;
try {
tran = session.beginTransaction();
this.session.update(o);
flag=true;
} catch (HibernateException e) {
log.error(e.toString());
flag=false;
throw new HibernateException("修改数据出错!"+e.getMessage()) ;
}
return flag;
}
[b]问题补充:[/b]
INFO com.c35.paris.dao.impl.UserDAOImpl.modifyById(UserDAOImpl.java:114) - modifyById method is running!
ERROR com.c35.paris.dao.impl.UserDAOImpl.modifyById(UserDAOImpl.java:121) - org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.c35.paris.vo.User#8aa3b3671d8ebd4c011d8ec457980003]
org.hibernate.HibernateException: 修改数据出错!a different object with the same identifier value was already associated with the session: [com.c35.paris.vo.User#8aa3b3671d8ebd4c011d8ec457980003]
问题补充:
怎么修改,
是下面的方法错了么?
public boolean modifyById(String id, Object o)throws Exception {
boolean flag=false;
log.info("modifyById method is running!");
Transaction tran = null;
try {
tran = session.beginTransaction();
this.session.update(o);
flag=true;
} catch (HibernateException e) {
log.error(e.toString());
flag=false;
throw new HibernateException("修改数据出错!"+e.getMessage()) ;
}
return flag;
}