sundeepprakash wrote:
I mean, at some point, Hibernate must check versions right? My understanding is that when a session is disconnected and reconnected, all objects in Session cache are automatically version verified by Hibernate. Is this correct?
add a <version> or <timestamp> tag into your mapping. That's all.
The version is checked for every updates
Quote:
When one module of code queries and retrieves some objects, they get put into the Session cache, right? Now when, as part of the same Transaction and same Session with no intervening disconnect/reconnects, another module of code queries and retrieves some objects, and some objects in the second query have the same database identity as objects in the first query, what guarantee is that their versions havent changed in between the queries?
1. Your tx isolation
2. the update where version=? made by hibernate when flushing