Hello.
I've come across a problem mapping my object model with nhibernate.
I have the following object model:
A top-level abstract class Element with many children and
descendants.
A class Event.
Each Element contains a bag of Events.
Each Event has a pointer to the parent Element.
Up till now - pretty standart one-to-many relationship.

But, I want to use table per concrete class strategy. So, the class
Element is not mapped to the data base. I've tried to solve it this
way: each of the concrete descendants of Element defines its own Bag
of Events. The problem with this is that each <bag> element contains a
<key> element. That key points to the Parent property of Event. It
also makes the Parent column in the Events table a foreign key to the
table which contains the Bag! But one column can't be a foreign key to
several tables and I'm getting an exception on insert.

I've also tried to make the Parent field in the Events table a many-to-
any kind of field. That worked. But when I want to make the relation
bidirectional, meaning, to add the bags to the descendants of Element
I come back to the same problem. Bag => foreign key => exception on
insert.

I'm sure this case isn't as unique as it seems.
Thank you in advance for your help.

--~--~---------~--~----~------------~-------~--~----~
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