HibernateUtil工具类

2019-08-01  本文已影响0人  沐之鱼
public class HibernateUtil {

    private static SessionFactory sessionFactory;

    static {
        Configuration configure = new Configuration().configure("hibernate.cfg.xml");
        sessionFactory = configure.buildSessionFactory();

    }

    public static Session openSession() {
        return sessionFactory.getCurrentSession();
    }
}
上一篇 下一篇

猜你喜欢

热点阅读