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();

 

 

你可能感兴趣的:(Hibernate,xml)