I\'m trying to replace at TimeBlock object on a ProgramItem and then delete the old TimeBlock object. It\'s the delete part that gives me problems. I have some \'relative\'
I tried explain what is happening in detail here
I would say, that the point is here: the ProgramItem is referenced by some other collection. And that collection was also loaded into the session.
The best place where to start is - wherever is ProgramItem used (collection item, reference) change the mapping to Cascade.None(). Then try to execute your deletion code. That will work... surely, becuase now cascading in place... no way how to trigger that exception.
Next - start cascading by pieces. Be sure you know what is allowed, and then you will know which reference, collection is re-saving your object.
My own experience/approach is - if you delete the item from one place, explicitly delete it from others as well, if there is cascade. It could be challenging, but...