Nhibernate mapping: delete collection, insert new collection with old IDs?

It sound like you are trying to tell nhibernate to update a detached entity, in this case nhiberante cannot know what entities as been added/removed in the collection.In this case you could use Merge: var mergedEntity = session. Merge(entityPasedFromClient) The merge operation will fetch the enity from the db compare it with the one that as been sent from the client and merge them, that way the entity that nhiberante fetch from the db (and is associated with the session) is modified and later fetched, the merged entity is returned (this will not be the same instance as the entity you pass the merge operation). I am not sure I understand the last part of your question: "so I decided to delete all the collection elements from the DB and call session.

Update with a new collection. And i've got an issue: nhibernate performs the UPDATE operation for the Field objects that has non-zero Id, but they are removed from DB! " Are the field items updated and then removed?

Session. Merge is just what the doctor said! Thanks alot!

I was quite goin' mad because of this.. whew.. – npeBeg Mar 31 '10 at 13:53.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions