I have an interesting scenario that I am looking for a solution to.
I have a object "Parent" that maps to table "tblParent" and there is a child table "tblChild" with a foreign key constraint to tblParent. However the Parent object does not have a Children collection or any such. For the purpose of my code I don't need the children nor really care much about them. However, I do need to be able to delete parent records. This works fine as long at the parent has no children. When it has children the delete fails because NHibernate doesn't know about the child table and doesn't know to cascade the delete.
So my question is, what is the cleanest way to make NHibernate aware of the relationship and enable a cascading delete in this situation? I don't want to add a Children property to the Parent object since its not needed by the domain logic.
Regards, Ken
|