title: @MappedSuperclass and implementation table
body: <p>I inherited some pretty awful code that I am looking to refactor to make more reusable.  There is a set of reporting tables which are primarily composed of 3 columns: <code>id</code>, <code>report_type_fk</code>, and <code>report_description</code>.  I would like to merge all the reporting tables into one for ease of use.</p>
  
  <p>I am refactoring the code and think that it would be better to break our current entities up so that <code>Report</code> is an abstract class with <code>type</code> implementations.  For example a <code>DmvReport extends Report</code>, <code>CreditScoreReport extends Report</code>, etc.  </p>
  
  <p>The problem I am running into is that there would only be 1 report table that all entities would need to save to.  Is there a way to make all concrete implementations of the <code>abstract Report</code> object save into the same table?</p>
  
  <p>Here's an example of the bad code I inherited</p>
  
  <p>Report class</p>
  
  <pre><code>@Entity
  @Table(name = "report")
  public class Report&lt;E extends Exception&gt; {
      private long id;
      private ReportType type;
      private String description;
     ...
     ...
  }
  </code></pre>
  
  <p>CreditReport class</p>
  
  <pre><code>@Entity
  @Table(name = "credit_report")
  public class CreditScore Report&lt;E extends Exception&gt; extends Report&lt;E&gt; {
      private long id;
      private ReportType type;
      private String description;
     ...
     ...
  }
  </code></pre>
  
  <p>I am looking to turn it into:</p>
  
  <pre><code>@MappedSuperclass
  @Table(name = "report")
  public abstract class Report&lt;E extends Exception&gt; {
      @Id @Column(name="id")
      private long id;
  
      @OneToOne(fetch = FetchType.EAGER)
      @JoinColumn(name = "report_type_id")
      private ReportType type;
  
      @column(name="description")
      private String description;
     ...
     ...
  }
  
  @Entity
  @Table(name = "report")
  public class CreditScoreReport&lt;E extends Exception&gt; extends Report&lt;E&gt; {
  
     public void doCreditScoreStuff(){
        ...
     }
  }
  
  @Entity
  @Table(name = "report")
  public class DmvReport&lt;E extends Exception&gt; extends Report&lt;E&gt; {
     public void doDmvStuff(){
        ...
     }
  }
  </code></pre>