public void updateCustomList(CustomList customList) {

Session session = customListDAO.getSession();
Transaction trans = null;
try{
trans = session.beginTransaction();
customListDAO.merge(customList);
trans.commit();


}catch(RuntimeException re){
trans.rollback();
}finally{
session.close();
}
}

解决方案 »

  1.   

    package com.hzsos.common.dao;import java.util.List;import org.hibernate.Query;import com.hzsos.common.pojo.CustomList;
    import com.jfsuite.util.db.BaseHibernateDAO;public class CustomListDAO extends BaseHibernateDAO { private static final String LOAD_ALL = "from CustomList"; public List findAll() {
    Query queryObject = getSession().createQuery(LOAD_ALL);
    return queryObject.list();
    } public CustomList findById(Integer id) {
    return (CustomList) getSession().get(CustomList.class, id);

    } public void save(CustomList customList) {
    getSession().saveOrUpdate(customList);
    }


    public void delete(CustomList customList){
    getSession().delete(customList);
    }

    public void delete(Integer id){
    getSession().delete(findById(id));
    }}
      

  2.   

    执行updateCustomList(CustomList customList) 后,数据库表中的记录被更新了,我在页面上取出来的数据还是老的数据。
      

  3.   


    是不是你缓存页面了?
    不要缓存页面试试>>>该怎么设置?