Home > Database > Mysql Tutorial > Hibernate工作过程

Hibernate工作过程

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:16:10
Original
1106 people have browsed it

1、读取并解析配置文件:这是使用Hibernate框架的入口,由Configure类来创建。2、读取并解析映射信息:调用Configure中的buildSe

1、读取并解析配置文件:这是使用Hibernate框架的入口,由Configure类来创建。

2、读取并解析映射信息:调用Configure中的buildSessionFactory()方法来实现,同时创建SessionFactory。

3、开启Session:调用SessionFactory的openSession()方法来实现。

4、创建事物管理对象Transaction:调用Session对象的beginTransaction()来实现。

5、数据交互操作:调用Session对象的各种操作数据库的方法来处理数据。例如增、删、改、查。通过save();createQuery();load();update();delete();beginTransaction();等方法。

6、提交事务:完成了对数据库的操作后应该提交事务,完成一次事务处理。

7、关闭Session:结束了对数据库的访问以后,应该立即关闭Session对象,,释放其占用的内存。

8、关闭SessionFactory:完成了全部的数据库操作后关闭SessionFactory对象。

linux

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template