I have a many-to-many mapping between Authors and Titles and I've
defined cascade="none" but when I delete an author NHibernate deletes
all titles for that author, except if I also set inverse to true. I
don't want the cascade operation to happen and I'm wandering why
NHibernate keeps deleting the associated titles even when
cascade="none".
So, what's the expected behavior for a colletion with cascade set to
none and inverse set to false (or not specified) ?
NHibernate 3.2.0 Alpha 2
Mapping:
<hibernate-mapping ... >
<class name="Author" table="authors" >
<id name="ID" type="System.String" column="au_id">
<generator class="assigned"/>
</id>
<property ... />
<property ... />
<property ... />
<bag name="Titles" table="titleauthor" cascade="none">
<key column="au_id" />
<many-to-many class="Title" column="title_id" />
</bag>
</class>
</hibernate-mapping>
Code:
using (ISession session = OpenSession()) {
using (ITransaction transaction = session.BeginTransaction())
{
Author aut = session.Get<Author>("xxx-xx-xxxx")
session.Delete(aut);
transaction.Commit();
}
}
Thanks in advance!
--
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.