title: Inherited abstract class with JPA (+Hibernate)
body: <p>How would you configure annotations in the following example code? I'd like to stick with JPA annotations only and avoid Hibernate specific dependencies. <strong>Is the code below correct?</strong></p>
  
  <pre><code>@Entity
  public class RefExample extends RefData {
  
  }
  </code></pre>
  
  <p>(There will be multiple versions of these classes, RefSomeOtherExample, etc, and one db table per class. Some may add additional fields (columns) but most will simply make use of the basic fields inherited from the "RefData" base class.)</p>
  
  <p>Base class:</p>
  
  <pre><code>@Entity
  public abstract class RefData {
  
      private long id;
      private String code;
      private String desc;
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Column(unique = true, nullable = false)
      public long getId() {
  
          return id;
      }
  
      public void setId(long id) {
  
          this.id = id;
      }
  
      @Column(unique = true, nullable = false, length=8)
      public String getCode() {
  
          return code;
      }
  
      public void setCode(String code) {
  
          this.code = code;
      }
  
      @Column(unique = true, nullable = false, length=80)
      public String getDesc() {
  
          return desc;
      }
  
      public void setDesc(String desc) {
  
          this.desc = desc;
      }
  }
  </code></pre>
  
  <p>Ultimately I'd like to generate schema creation scripts from this using Hibernate's SchemaExport class.  In the case above these two classes should only result in the creation of a single table named "RefExample" with the three columns from "RefData". Will this work?</p>