Hibernate commit() 和flush() 的区别
来源:互联网 发布:回收手机的软件 编辑:程序博客网 时间:2024/05/09 09:15
Hibernate commit() 和flush() 的区别
孙卫琴<<精通Hibernate java对象持久化技术详解>>p177 说,flush()方法进行清理缓存的操作,执行一系列的SQL语句,但不会提交事务;commit()方法会先调用flush()方法,然后提交事务. 提交事务意味着对数据库所做的更新会永久保持下来
p148 所谓清理,是指Hibernate 按照持久化象的状态来同步更新数据库
Flush()后只是将Hibernate缓存中的数据提交到数据库,如果这时数据库处在一个事物当中,则数据库将这些SQL语句缓存起来,当Hibernate进行commit时,会告诉数据库,你可以真正提交了,这时数据才会永久保存下来,也就是被持久化了.
commit针对事物的
flush针对缓存的
同步到数据库中后只要没有commit还是可以rollback的。
- Hibernate commit() 和flush() 的区别
- Hibernate commit() 和flush() 的区别
- Hibernate中commit()和flush()的区别
- Hibernate commit() 和flush() 的区别
- Hibernate commit() 和flush() 的区别
- hibernate中的session.flush()和commit()的区别
- hibernate commit和flush
- Hibernate中session的flush方法和commit()方法区别
- 论hibernate中的session.flush()和transaction.commit()的差异
- Flush和Commit的理解
- hibernate flush和clear方法的区别
- Hibernate session flush commit
- hibernate flush与commit
- HIbernate commit() and flush()
- hibernate的缓存机制与生命周期——flush和commit方法
- Hibernate中持久化上下文的flush操作之一COMMIT
- 【mysql】sqlalchemy commit 和 flush
- Hibernate:session.flush与transaction.commit
- linux设备驱动归纳总结(七):2.内核定时器
- Matlab中的YALMIP工具箱 混合整数规划
- linux设备驱动归纳总结(八):1.总线、设备和驱动
- 50款令你惊讶的免费Ps笔刷资源
- linux设备驱动归纳总结(八):2.match.probe.remove
- Hibernate commit() 和flush() 的区别
- linux设备驱动归纳总结(八)3设备模型的分层与面向对象
- POJ 2406 - Power Strings
- 【100题】 第四十七题 序列的最长递增、递减序列
- linux设备驱动归纳总结(八):4.总线热插拔
- 定义一个时间类,提供设定时间、显示时间和秒数增加1的功能,其中设定时间的方法需要校验数据的正确性
- linux设备驱动归纳总结(九):1.platform设备驱动
- 用例图新解
- linux设备驱动归纳总结(十):1.udev&misc