In NHibernate documentation (section 9.2 - http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html_single/#manipulatingdata-flushing) I'm led to believe that when modifying collection elements NHibernate will perform deletes, updates then inserts.
I have the following problem: I have an entity with a collection of items (the collection has cascade=all-delete-orphan) and the items have a unique key. I'm trying to delete an element from the collection (by doing a remove from the list) and then changing the key of an existing element to the one that was removed from the list. The problem I'm experiencing is that the update is occurring before the delete when I commit the changes to the entity and consequently violating the unique key. The code looks something like this: item = entity.collection[0]; item2 = entity.collection[1]; entity.collection.Remove(item); item2.name = item.name; session.SaveOrUpdate(entity); session.Commit; Do you think this is a bug or am I doing something wrong? Darren --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
