Reputation: 908
I read that whether a call to session.flush()
commits or not depends on the FlushMode
that is set. However, I don't know which FlushMode
does this. I want the session to be flushed and commited. Which FlushMode should I use?
Upvotes: 0
Views: 3045
Reputation: 1751
It's the other way around. you can flush when calling commit. These are the flushmodes in Hibernate: 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.
The Session is only ever flushed when Session.flush() is explicitly called by the application.
I think you are looking for AUTO. So the session is flushed on Commit
Upvotes: 2
Reputation: 15308
I'd say vice versa - whether Hibernate flushes or not on commit depends on FlushMode.
Upvotes: 0