首页 > 代码库 > Hibernate 获取Session

Hibernate 获取Session

Configuration cfg = null;
SessionFactory factory = null;
Session session = null;
Transaction tx = null;
@Before
public void init(){
cfg = new Configuration().configure();
factory = cfg.buildSessionFactory();
session = factory.openSession();
tx = session.beginTransaction();
}

Hibernate 获取Session