首页 > Web开发 > 详细

delete update在hibernate中的使用

时间:2016-09-30 11:41:22      阅读:282      评论:0      收藏:0      [点我收藏+]

之前在hibernate中使用了save方法,使用getCurrentSession不需要自己管理事务,很方便.

sessionFactory.getCurrentSession().save(applicationInfo);

同事update和delete也有两种类似方法:

Session session = sessionFactory.getCurrentSession();
session.update(applicationInfo);
session.flush();
Session session = sessionFactory.openSession();
session.beginTransaction();
session.update(applicationInfo);
session.getTransaction().commit();

使用getCurrentSession和openSession的具体实现存在差异.

delete update在hibernate中的使用

原文:http://www.cnblogs.com/sosayweall/p/5923065.html

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