首页 > Web开发 > 详细

Hibernate(2)

时间:2015-11-20 20:10:20      阅读:246      评论:0      收藏:0      [点我收藏+]

hibernate的工作原理
1.通过Configuration config = new Configuration().configure();//读取并解析hibernate.cfg.xml配置文件
2.由hibernate.cfg.xml中的<mapping resource="com/xx/User.hbm.xml"/>读取并解析映射信息
3.通过SessionFactory sf = config.buildSessionFactory();//创建SessionFactory
4.Session session = sf.openSession();//打开Sesssion
5.Transaction tx = session.beginTransaction();//创建并启动事务Transation
6.persistent operate操作数据,持久化操作
7.tx.commit();//提交事务
8.关闭Session
9.关闭SesstionFactory

本文出自 “LJ_DB” 博客,请务必保留此出处http://10878793.blog.51cto.com/10868793/1715106

Hibernate(2)

原文:http://10878793.blog.51cto.com/10868793/1715106

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!