title: Discriminator based on joined property
body: <p>Suppose I have this relationship:</p>
  
  <pre><code>abstract class Base { int Id; int JoinedId; ... }
  class Joined { int Id; int Discriminator; ... }
  class Sub1 : Base { ... }
  class Sub2 : Base { ... }
  </code></pre>
  
  <p>for the following tables:</p>
  
  <pre><code>table Base ( Id int, JoinedId int, ... )
  table Joined ( Id int, Discriminator int, ... )
  </code></pre>
  
  <p>I would like to set up a table-per-hierarchy inheritance mapping for the Base, Sub1, Sub2 relationships, but using the Disciminator property from the Joined class as the discriminator.</p>
  
  <p>Here's the general idea for the mapping file:</p>
  
  <pre><code>&lt;class name="Base" table="Base"&gt;
      &lt;id name="Id"&gt;&lt;generator class="identity"/&gt;&lt;/id&gt;
  
      &lt;discriminator /&gt; &lt;!-- ??? or &lt;join&gt; or &lt;many-to-one&gt;? --&gt;
  
      &lt;subclass name="Sub1" discriminator-value="1"&gt;...&lt;/subclass&gt;
      &lt;subclass name="Sub2" discriminator-value="2"&gt;...&lt;/subclass&gt;
  &lt;/class&gt;
  </code></pre>
  
  <p>Is there any way of accomplishing something like this with the <code>&lt;discriminator&gt;</code>, <code>&lt;join&gt;</code>, or <code>&lt;many-to-one&gt;</code>? NHiberante seems to assume the discriminator is a column on the given table (which makes sense to me.. I know this is unorthodox).</p>
  
  <p>Thanks.</p>