session Filter

 

import org.hibernate.FlushMode;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.dao.DataAccessResourceFailureException;
import org.springframework.orm.hibernate3.SessionFactoryUtils;
import org.springframework.orm.hibernate3.support.OpenSessionInViewFilter;

public class PmsOpenSessionInViewFilter extends OpenSessionInViewFilter
{

    protected void closeSession(Session session, SessionFactory sessionFactory)
    {
        session.flush();
        super.closeSession(session, sessionFactory);
    }

    protected Session getSession(SessionFactory sessionFactory)
            throws DataAccessResourceFailureException
    {
        Session session = SessionFactoryUtils.getSession(sessionFactory, true);
        this.setFlushMode(FlushMode.AUTO);
        FlushMode flushMode = getFlushMode();
        if (flushMode != null)
        {
            session.setFlushMode(flushMode);
        }
        return session;
    }

}

阅读更多
个人分类: flex
想对作者说点什么? 我来说一句

struts1.2增删改查分页Filter Session

2013年05月07日 593KB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭