Spring
共 1 篇文章
<转>openSession和getCurrentSession的比较
在比较openSession和getCurrentSession这两个方法之前,我们先认识一下这两个方法。 在进行配置信息管理时,我们一般进行一下简单步骤: Configuration cfg = new Configuration(); // 获得配置信息对象 SessionFactory sf = cfg.configure().buildSessionFactory(); //解析并建立Session工厂 1. Session session = sf.getCurrentSession(); // 获得Session 2. Session session = sf.openSessi…
2015-09-18 11:33 · Spring · Hibernate · openSession · getcurrentsession