Hibernate的执行过程

来源:互联网 发布:道德知乎 编辑:程序博客网 时间:2024/05/17 06:39

Hibernate运行过程:

1.通过Configuration().configure();读取并解析hibernate.cfg.xml配置文件

2.由hibernate.cfg.xml中的<mappingresource="com/xx/User.hbm.xml"/>读取并解析映射信息

3.通过config.buildSessionFactory();//创建SessionFactory

4.sessionFactory.openSession();//打开Sesssion

5.session.beginTransaction();//创建事务Transation

6.persistent operate持久化操作 //一般指Save这个方法

7.session.getTransaction().commit();//提交事务

8.关闭Session

9.关闭SesstionFactory



原文地址:http://blog.csdn.net/lsh6688/article/details/7611950

0 0