Hibernate框架的工作流程
1.通过Configuration().configure();读取并解析hibernate.cfg.xml配置文件 2.由hibernate.cfg.xml中的<mapping resource="com/xx/User.hbm.xml"/>读取并解析映射信息 3.通过config.buildSessionFactory();//创建SessionFactory 4.sessionFactory.openSession();//打开Sesssion 5.session.beginTransaction();//创建事务Transation 6.使用session对象的具体方法完成持久化操作 7.session.getTransaction().commit();//提交事务 8.关闭Session 9.关闭SesstionFactory
转载于:https://www.cnblogs.com/zhuhuibiao/p/9825267.html
相关资源:JAVA上百实例源码以及开源项目