I have NHibernate sessions cached in an ASP.NET session.
I came across a situation where the user edited the object so that it was in the first level cache in ISession. Then another user edited the same object.
At this point, User1 still sees its original version of its changes, when User2 sees the correct state of the object?
What is the correct way to handle this without manually calling session.Refresh (myObj) explicitly for every single object all the time?
I also have second level cache enabled. For NHibernate Long Session, should I completely disable first level cache?
Edit: Adding another terminology to what I expect from 10.4.1. A long session with automatic versioning ends at the end of this section.
Since ISession is also a (mandatory) first level cache and contains all loaded objects, we can use this strategy for only a few request / response cycles. This is really recommended, since ISession will also have outdated data soon.
Iām not sure what kind of documentation it is to include both, and immediately say that the session will have outdated data (this is what I see). What is the solution for this right here or not?
source share