Hello,
My problem is as follows I got a many-to-many collection which is a
List<User>.
A user can belong to many division. The problem is now if I i.e. load a
division from the DB and Clear() the users
and want to store it back to the database I get the following nhibernate
exception:
"NHibernate.ObjectDeletedException: deleted object would be re-saved by cascade
(remove deleted object from associations)"
As well I just removed it from the associations, no? I don't want to
delete the User or Users added to the division as there is the
possibility they
are added to other divisions as well, to determining that I want to keep
to nhibernate.
I got 3 tables "division table" for mapping the division object
"userdivision table" storing associations between divisions and users
and the "user table" for storing user informations.
I don't get why it should get resaved.
I want to cascade all changes to User and if theres no reference to a
User left from any division that user should get deleted (thats what
delete-orphan should be used for?).
The bag of the division mapping looks as follows:
<bag name="Users" table="userdivision" cascade="all-delete-orphan">
<key column="Division"/>
<many-to-many column="UserId" class="User" />
</bag>
Steve
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---