Difference between FlushMode.AUTO and FlushMode.ALWAYS in sleep mode?

Passed the hibernate api specification on FlushMode, but did not get the exact difference. So please help.

+6
java hibernate
source share
2 answers

It always means that before any query is launched in the collection or such a query is re-launched with the database. With automatic, I assume that there are some โ€œmagicโ€ under the hoods that know that most of the data doesn't change as often, so you don't always need to hide it. It also affects the frequency of the transaction. I say, maybe because some sources say that installing a flash mode is just a hint for sleep mode - but look at this topic for discussion ...

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

+2
source share

If the flash mode is "AUTO" before starting any sleep mode, it will check if there are any tables to update. If so, the flash will be executed differently. If the flash mode is "ALWAYS", then a reset will occur even if there are no tables that need to be updated.

Check out the source, org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush (AutoFlushEvent)

+5
source share

All Articles