I always think that cascade="delete-orphan" apply ONLY to collection
associations (one-to-many in a set or bag) - not to many-to-one
association.
And probably there is NO way for nHibernate to know that there are
some other references to this city - from another Address object or
from object of totally different class... At least if they are not
loaded in session.
nHibernate work "in memory" - it doesn't know about any DB
constraints, triggers or other stuff. And it doesn't put a piece of
code to DB side to track something.
You can't "delete" City every time a single reference to it is
destroyed - the opposite cascade may exist (if you'll have bag/set in
City class references all Addresses belong to this city) -
cascade="all" will delete a City and all its Addresses if you delete
City, but not vise-versa.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to