I've posted a question on StackOverflow and despite a few views, I've
no downvotes but also no answers - does anyone have any idea?

http://stackoverflow.com/questions/8493799/how-to-force-nhibernate-3-1-to-detect-collection-modifications-after-a-session-m

For those who prefer not to click links, here's the summary example:

- I have a simple parent object with a collection of its children
- I use Session.Merge on the parent
- I clear and reseed the child collection with new instances (this is
a contrived example)
- I call Session.Merge again
- (The second Session.Merge returns a parent that has the number of
children I expected - namely, the number I put in the second time. )
- I commit
- The database has now got a compound set of children because both
were inserted, even those that were cleared
- Clearing the Session and reloading from the database, I get
everything back (as you'd expect, given everything went to the db) but
crucially it's a) different from the initial result of the Merge and
b) not reflected that Clear() that I ran on the child collection
between the two calls to Merge

>From debugging I can see that the inserts were registered in the
Session's ActionQueue but were not removed when I called Clear() on
the collection
I tried Session.Delete(..) on the collection contents before calling
Clear() and this resulted in correct items in the db, but only after
issuing inserts followed immediately by deletes

Does anyone know how to clear the above example collection without
issuing inserts + deletes to the db?

Many thanks in advance,
Alex

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to