To clarify: even if NHibernate issues a SELECT for some entities that are already in first level cache (the ISession), it won't try to compare the newly returned values with the current ones stored in the cache.
RP On Friday, October 31, 2014 11:56:46 AM UTC, Ricardo Peres wrote: > > I think this is related to first level cache: loaded entities are stored > there, and are not updated unless you explicitly call ISession.Refresh() > upon them, or, of course, if you Clear() the ISession. > > RP > > > On Friday, October 31, 2014 11:13:37 AM UTC, Koen Verrijt wrote: >> >> Hello, >> >> I've been trying to update a list of objects which was changed outside of >> the application. >> Here's the statement I use: >> >> Parent parent = Session.QueryOver<Parent>().Where(x => x.Dbid == dbid) >> .JoinQueryOver<Child>(y => y.Children) >> .CacheMode(CacheMode.Refresh) >> .SingleOrDefault(); >> >> return parent.Children >> >> This returns the children when a record is added or deleted. This won't >> work when CacheMode is set to normal, which is good. >> Thing is, when I update a child in the database and run this code, it >> returns the old, not updated, children. Even though the query returns the >> correct values, therefore I think this has something to do with caching. >> >> So my question is, why doesn't this statement return the updated children? >> > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
