title: Table Per Class Inheritance with FluentNHibernate - Identity generation
body: <p>I have a set of payment objects that come from different sources that I'd like to use an TPC inheritance in NHibernate for.  The base for all these object is the payment processor (so all have a consistent format), however there is no representation of the base class in the database.  I think I have my mapping worked out, except for the fact that I get an exception thrown when trying to insert - "Cannot use identity column key generation with &lt;union-subclass&gt; mapping for: &lt;EntityName&gt;"</p>
  
  <p>Classes:</p>
  
  <pre><code>public class BasePayment
  {
      public virtual int Id { get; set; }
      public virtual PaymentSource Source { get; set; }
      public virtual DateTime Date { get; set; }
      public virtual decimal Amount { get; set; }
  }
  
  public class SubPayment : BasePayment
  {
  }
  </code></pre>
  
  <p>Mappings:</p>
  
  <pre><code>public class BasePaymentMap : ClassMap&lt;BasePayment&gt;
  {
      public BasePaymentMap()
      {
          UseUnionSubclassForInheritanceMapping();
          DiscriminateSubClassesOnColumn("Source");
          Id(m =&gt; m.Id);
          Map(m =&gt; m.Source);
          Map(m =&gt; m.Amount);
          Map(m =&gt; m.Date);
      }
  }
  
  public class SubPaymentMap : SubclassMap&lt;SubPayment&gt;
  {
      public SubPaymentMap()
      {
          DiscriminatorValue(PaymentSource.SourceX);
          Abstract();
          Table("SourceXPayments");
      }
  }
  </code></pre>
  
  <p>And that's as far as I've got.  On a SaveOrUpdate, I'm getting the error above, and a google search is not proving helpful thus far - I have found this question: <a href="https://stackoverflow.com/questions/916169/cannot-use-identity-column-key-generation-with-union-subclass-table-per-clas">Cannot use identity column key generation with &lt;union-subclass&gt; ( TABLE_PER_CLASS )</a> which appears to cover the issue in Java/Hibernate, but I'm having a problem with converting the <code>@GeneratedValue(strategy = GenerationType.TABLE)</code> into a Fluent syntax, as Fluent NHibernate's <code>GeneratedBy()</code> method doesn't seem to have a table, or a lot of documentation (that I have found) as to what it does under the covers.</p>
  
  <p>Doing some more reading around it seems that this might not be possible, so if anyone can confirm this or offer a work around for the situation, it'd be greatly appreciated.</p>
  
  <p>If I've not given enough detail, please let me know what would be more use.</p>
  
  <p>Thanks in advance</p>