title: DiscriminatorFormula
body: <p>If I have a single table where I need multiple columns for discriminator, is my only solution to use a @DiscriminatorFormula?</p>
  
  <p>I ask because some prototyping gave us some results that I cannot explain.</p>
  
  <p><strong>Failed Prototype:</strong> Initially we prototyped a 3-deep class hierarchy using one @DiscriminatorColumn on the super class and included the second @DiscriminatorColumn on subclasses.  Of course we got this warning:</p>
  
  <blockquote>
    <p>Discriminator column has to be defined in the root entity, it will be ignored in subclass  </p>
  </blockquote>
  
  <p>We found that updates worked, but inserts did not.  So we scrapped that idea.</p>
  
  <p><strong>Successful? prototype:</strong>
  We then tried the following which seems to work: Omit the second @DiscriminatorColumn on the subclasses and just include the @JoinColumn on a foreign key (which we were going to need anyway).  Perhaps, since the joins are to different types of objects, Hibernate/JPA seems to be able to figure out which subclass is correct.  Can anyone explain that?</p>
  
  <p>Should we scrap that and just use @DiscriminatorFormula to get the <strong>explicit</strong> relationship defined on the 2 discriminator columns?</p>