[英]Which FlushMode in Hibernate commits when you call session.flush()?
I read that whether a call to session.flush()
commits or not depends on the FlushMode
that is set. 我读到对
session.flush()
的调用是否提交取决于设置的FlushMode
。 However, I don't know which FlushMode
does this. 但是,我不知道哪个
FlushMode
这样做。 I want the session to be flushed and commited. 我希望会话被刷新并提交。 Which FlushMode should I use?
我应该使用哪种FlushMode?
It's the other way around. 这是相反的方式。 you can flush when calling commit.
你可以在调用commit时刷新。 These are the flushmodes in Hibernate: FlushModes
这些都是在Hibernate中flushmodes: FlushModes
The Session is flushed before every query. 会话在每次查询之前刷新。
The Session is sometimes flushed before query execution in order to ensure that queries never return stale state. 在查询执行之前,有时会刷新会话,以确保查询永远不会返回失效状态。
The Session is flushed when Transaction.commit() is called. 调用Transaction.commit()时刷新会话。
The Session is only ever flushed when Session.flush() is explicitly called by the application. 只有在应用程序显式调用Session.flush()时才会刷新Session。
I think you are looking for AUTO. 我想你正在寻找AUTO。 So the session is flushed on Commit
因此会话在Commit上刷新
反之亦然 - Hibernate是否在提交时刷新取决于FlushMode 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.