Good morning.

I am still struggling to find a solution to this.  Does anyone have any 
suggestions?

Regards,

Ron

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
rdenis
Sent: Thursday, November 04, 2010 10:30 AM
To: nhusers
Subject: [nhusers] Problems with a bag of joined subclass entities

Guys,

As the title says, i have a mapping issue.  I have tried to condense the issue 
into a contrived example as follows.

I have:

1) A Person entity with a PersonKey primary key.
2) An Attribute entity with a reference to Person (has a PersonKey foreign key).
3) A Race entity that is a joined subclass of the Attribute entity.
4) The Person entity has an IList of Race entities (a Races property).

The problem is that nhibernate doesn't seem to recognize that Race will inherit 
the PersonKey from Attribute.  In the sql generation it wants to add a 
PersonKey column to Race.  Also, when I access the Races property of Person, 
the lazy load mechanism kicks in tries to query the list of Race entities by 
accessing Race.PersonKey, which, again should come from the Attribute class.

Any help would be greatly appreciated.

------------------------------

Additional Information:

The Person mapping:

<class name="Person" table="Person">
  <id name="Key" ....
    <column name="PersonKey" />
    ...
  </id>
  <bag inverse="true" name="IntoleranceConditions">
    <key>
      <column name="PersonKey" />
    </key>
    <one-to-many class="Race" />
  </bag>
</class>

The Attribute and Race Mappings:

<class name="Attribute" table="Attribute">
  <id name="Key" ...
    <column name="AttributeKey" />
    ...
  </id>
  <joined-subclass name="Race">
    <key foreign-key="Foo_FK">
      <column name="AttributeKey" />
    </key>
  </joined-subclass>
</class>

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

________________________________
The contents of this e-mail and any attachments are intended solely for the use 
of the named addressee(s) and may contain confidential and/or privileged 
information. Any unauthorized use, copying, disclosure, or distribution of the 
contents of this e-mail is strictly prohibited by the sender and may be 
unlawful. If you are not the intended recipient, please notify the sender 
immediately and delete this e-mail.

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