What is a Hibernate dirty session?
hibernate, java
Solution
The Hibernate session is a cache. It caches entities read from the database, and it also caches changes you've made to entities it contains, as well as added and removed entities, until the session is flushed (i.e. all the pending changes are written to the database).
A session is said dirty when some changes have not been flushed yet. And it's thus perfectly normal to have a dirty session. The session is flushed before the transaction is committed.
Problem
I was wondering if anybody could tell me what a hibernate dirty session is? I seem to be having an issue where a criteria query is performing an insert when it shouldn't. I believe it's related to a dirty session, but without knowing truly what a dirty session is, I'm unable to resolve my issue. Also, how do you create a dirty session. Thanks.