本文介绍了Hibernate中FlushMode.AUTO和FlushMode.ALWAYS之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已经通过了FlushMode的hibernate API规范,但没有得到确切的区别。所以请帮助。总是表示在对集合运行任何查询之前,或者对数据库重新运行查询。对于汽车,我假设在引擎盖下有一些魔术,知道大多数数据不会经常更改,所以您不必总是冲洗。它也影响交易过程中可能发生的频率。我说可能是因为一些消息来源说设置flushmode只是hibernate的一个暗示 - 但是看到这个线程进行一些讨论...



http://forum.springsource.org/archive/index.php/t-14044.html


Have gone through hibernate api specification on FlushMode but didn't get the exact difference. So please help.

解决方案

Always means that before any query is run on a collection or such the query is rerun against the database. With auto I am assuming there is some "magic" under the hoods that knows most data doesn't change that often so you don't always have to flush. It also affects how often might happen during a transaction. I say might because some sources say setting the flushmode is only a hint to hibernate - but see this thread for some discussion...

http://forum.springsource.org/archive/index.php/t-14044.html

这篇关于Hibernate中FlushMode.AUTO和FlushMode.ALWAYS之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 11:58