Hibernate4 中 update 不执行,怎么办呀

Action层:
public String edit(){
Folder folder = folderService.findById(model.getId());

    folder.setName(model.getName());
    folder.setDescription(model.getDescription());

    if (parentId != null) {
        Folder parent = folderService.findById(parentId);
        model.setParent(parent);
    } else {
        model.setParent(null);
    }

    folderService.update(folder);
    return "toList";
}
serviceImpl层:
public void update(Folder folder) {
    folderDao.update(folder);

}

BaseDao:
public interface IBaseDao<T> {
/**
 * 添加
 */
public void save(T entity);

/**
 * 根据id删除
 */
public void delete(Long id);

/**
 * 根据id修改
 */
public void update(T entity);

/**
 * 根据id查询
 */
public T getById(Long id);

/**
 * 一次查询多个对象
 */
public List<T> getByIds(Long[] ids);

/**
 * 查询所有
 */
public List<T> findAll();

/**
 * 公共分页方法
 */
public PageBean getPageBean(HQLHelper hh, int currentPage);

}

BaseDaoImpl:
@Resource
private SessionFactory sessionFactory;

private Class<T> clazz;

public BaseDaoImpl() {
    //获得实体类型
    ParameterizedType genericSuperclass = (ParameterizedType) this.getClass().getGenericSuperclass();//获得真正的父类
    Type[] types = genericSuperclass.getActualTypeArguments();
    clazz = (Class<T>) types[0];
}

public void save(T entity) {
    getSession().save(entity);
}

public void delete(Long id) {
    getSession().delete(getSession().get(clazz, id));
}

public void update(T entity) {
    getSession().update(entity);
}

https://www.cnblogs.com/klslb/p/7278937.html

加一个getSession().flush();就可以了

public void update(T entity) {
getSession().update(entity);
getSession().flush();
}