Hello,
Is there any way to make one-many bag association from an entity to a
subclass (with join)?
Just an isolated example:

<class name="Person">
<!-- blah blah -->
<discriminator column="PersonType" />
</class>

<subclass name="Employee" discriminator-value="Employee">
<!-- blah blah -->
<join table="Emplooyee">
  <key column="PersonId" />
  <many-to-one name="Company" column="CompanyId" class="Company" />
</join>
</subclass>

<class name="Company">
<!-- blah blah -->
<bag name="Employees">
  <key column="CompanyId" />    ---------------> this fails
  <one-to-many class="Employee" />
</bag>
</class>

That bag will fail because it will seek CompanyId under Person table,
instead of from the Employee table, which is understantable. But my question
is if it's possible to achieve what I am going for. I cannot use
joined-subclass, because in my real case (NotificationPolicy base-class),
most of the subclasses don't have additonal properties (only different
behavior), hence discriminnator column is more appropriate. Only in certain
subclass do I need to join with another table for additional properties, but
in NHibernate I'm not allowed to mix subclass and joined-sublass on the same
inheritance hierarchy.
Does anyone have any solution or workaround to make the above example work?

Thanks

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