public class StudentTest {
public static void main(String args[]){
Student stu = new Student();
stu.setSid("3");
stu.setAge(25);
stu.setSname("李惠堂");
Configuration cfg = new Configuration();
SessionFactory sf = cfg.configure().buildSessionFactory();
Session session = sf.openSession();
session.beginTransaction();
session.save(stu);
session.getTransaction().commit();
session.close();
sf.close();
}
}
Hibernate4之Hello World(基础环境搭建)(2)
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://www.heiqu.com/e12f6bcf1cb70e27c87bdc903534471d.html