Test case in uNhAddIns issues tracker, please.About dirty checking "In my opinion it should be an option disabled by default", thanks for your opinion but it is one of the most useful feature of NHibernate. If you don't like AutoDirty check and the code in uNhAddIns does not cover exactly what you are looking for you are invited to share your failing test in : http://code.google.com/p/unhaddins/issues/list
<http://code.google.com/p/unhaddins/issues/list>The mailing list is: http://groups.google.com/group/unhaddins <http://groups.google.com/group/unhaddins>Thanks. 2009/8/12 Nelson <nelson.cab...@gmail.com> > > I got the same problem. NHibernate is flushing the whole first-level > cache while I wanted to update a single entity. > I tried the code available at > > http://code.google.com/p/unhaddins/source/browse/#svn/trunk/uNhAddIns/uNhAddIns/Listeners/AutoDirtyCheck > , however it does not work in all cases. > > I encountered several problems. > > - Only loaded items are marked as ReadOnly. Once they are updated or > if they are inserted their state is Loaded, then they are auto-flushed > again. This problem is fixed by implementing IPostInsertEvent and > IPostUpdateEvent. > - Then if an entity is explicitely SaveOrUpdated, but NHibernate finds > it is not dirty (thank you second level cache?), then its state is set > at Loaded by SaveOrUpdate event listener but is never reversed back > (because it is not inserted nor updated). The solution I found is to > create an interceptor which implements PostFlush() and reverts back > the entity state. > - Finally I bumped into another problem. After looking in > AbstractFlushingEventListener.FlushEverythingToExecutions(FlushEvent > @event), i found this : > .... > FlushEntities(@event); > FlushCollections(session); > ... > I guess there that any persistent collection is also flushed. If a > persistent collection contains a transient entity, the transient > entity will be added/saved implicitely, even if saveorupdate() has not > be called on the containing entity. > I still haven't found a workaround for this one, if someone has an > idea I'd love to try it. > > It took me days to understand my current problems were due to > automatic dirty checking. This implicit behaviour of NHibernate is not > obvious. In my opinion it should be an option disabled by default. > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to nhusers@googlegroups.com To unsubscribe from this group, send email to nhusers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---