I read in another thread (
http://forum.hibernate.org/viewtopic.php?t=957657) that "A list is an indexed bag", which makes perfect sense. But when an item occurs more than once in a list, and I try to delete one of those occurrences by removing it from the list then updating the list's container with
Code:
session.Update( container );
session.Flush();
NHibernate then throws an exception:
Code:
{"deleted object would be re-saved by cascade (remove deleted object from associations): 43, of class: Test.SampleItem"}
In the mapping file, the list's cascade attribute is set to "all-delete-orphan":
Code:
<class name="SampleListContainer">
...
<list name="SampleList" table="Item_List" cascade="all-delete-orphan">
<key column="ListContainerID"/>
<index column="PosN"/>
<many-to-many column="ItemID" class="SampleItem"/>
</list>
What am I getting wrong here?
Hibernate version:
version 1.2.0.GA
Name and version of database:
SQL Server 2005 Express, Service Pack 2