hibernate(马士兵)

1.读取hibernate.cfg.xml配置文件

Configuration cfg = new Configuration();
SessionFactory sf = cfg.configure().buildSessionFactory();
org.hibernate.Session session = sf.openSession();
session.beginTransaction();
		
session.save(s);
		
session.getTransaction().commit();
session.close();
sf.close();

猜你喜欢

转载自lrstom.iteye.com/blog/1070126