Why does Hibernate only Auto-Flush inside a transaction?

我是研究僧i 提交于 2019-12-05 09:19:53

Because the docummentation for FlushMode says

The Session is sometimes flushed before query execution in order to ensure that queries never return stale state. This is the default flush mode.

So, auto doesn't mean what you think it means. The name is, arguably, badly chosen, but it doesn't mean a flush is made after each session operation. It's thus not similar to JDBC's autocommit, which makes a commit after ever JDBC statement.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!