I have multiple sessions working in my database at the same time. (regular DB session and NHibernate session)
The first time when I get an Entity from the D.B. the entity is stored in the first level cache – identity map.
what happens if after the first query The entity changed outside the NH session? the data is stale.
session.Get<Cat>(1).Name == "Bar" // true
// different session trigger updated the cat name to "Foo"
session.Get<Cat>(1).Name == "Bar" // true
Is there a way to sync NHibernate session to changes outside the session?
That’s easy: