Session.Update assigns ID to not saved child entity

I have a parent entity with a collection of children. The parent is already persisted. The cascading to children is set to “AllDeleteOrphan”. The parent entity is detached from session. The ID generator for the child entity is set to “sequence”.

Now, the problem is: when I call session.Update(parent) the child entity gets a ID assigned from NHibernate, which is wrong, because I only want to put the parent entity to session. Then, of course, calling session.Flush() throws the “row was updated…” exception.

First of all, this is not an NHibernate forum. This is a forum for Hibernate projects located at

Second, the described behavior is expected. When you call update, the parent will be reassociated and the operation will cascade to children which will be attached as well, hence their identifiers being generated.

As for the “row was update” exception, I don’t understand why you’d get that, but you can ask the question on the NHibernate forums as they surely know better their framework.