Joined: Mon May 04, 2009 5:47 pm Posts: 2
|
Using nHibernate 1.2
Issue: Trying to figure out how the 'session' cache works.
Form 1: 'Search Form' - Users select criteria from drop down boxes, click 'Search' and results appear in grid. IBindingList wrapping nhibernate objects. I am forced to call 'Session.clear' every time I click filter so that database updates are reflected in my results. I am using 'session.CreateCriteria'. [Results is an ArrayList of my objects] I have tried Results.Clear and Results = Nothing but still am forced to use session.clear to see database updates.
Form 2: 'Create Object Form' - Users key in object properties from text boxes / numeric boxes and drop downs. When you click save the object checks to see if there are any other objects in the database the have the same values for certain properties (this is NOT a PK lookup and these are not DB Constraints). This 'validate' routine always seems to find the database updates. I am also using 'session.CreateCriteria' to search the database for 'similar/conflicting' objects.
Question: I am trying to understand why one use of (session.CreateCriteria).List() 'sees' the database updates and the other does not. I imagine it has to do with scoping but I cannot find a firm answer. There are like 50 million articles on second level cache but I haven't been able to find any exhaustive articles on first level cache.
|
|