title: JPA @Entity Inheritance
body: <p>I have been looking into JPA/Hibernate <code>@Entity</code> inheritance for a while now and can't seem to find anything that addresses what I am trying to achieve.</p>
  
  <p>Basically I want to be able to define an <code>@Entity</code> with all of the column and table mappings as required. Then I want to be able to extend the <code>@Entity</code> in a number of different locations with different sets of <code>@Transient</code> methods defined in the body of each "sub-Entity". This is a basic example of what I am trying to achieve but with no success thus far:</p>
  
  <pre><code>@Entity
  @Table(name = "mountain")
  public class MountainEntityBase implements Serializable {
      public Integer mountainId = 0;
      public Integer height = 0;
  
      public List&lt;ExplorerEntityBase&gt; explorers = new ArrayList&lt;ExplorerEntityBase&gt;();
  
      @Id
      @GeneratedValue
      @Column(name = "mountain_id")
      public Integer getMountainId() { return mountainId; }
      public void setMountainId(Integer mountainId) { this.mountainId = mountainId; }
  
      @Column(name="height")
      public String getHeight() { return height; }
      public void setHeight(String height) { this.height = height; }
  
      @OneToMany(mappedBy="mountainId")
      public List&lt;ExplorerEntityBase&gt; getExplorers() { return this.explorers; }
      public void setExplorers(List&lt;ExplorerEntityBase&gt; explorers) { this.explorers = explorers; }
  
  }    
  </code></pre>
  
  <p>.</p>
  
  <pre><code>@Entity
  public class MountainEntity extends MountainEntityBase implements Serializable {
  
      public List&lt;MountainEntity&gt; allMountainsExploredBy = new ArrayList&lt;MountainEntity&gt;();
  
      @Transient
      public List&lt;MountianEntity&gt; getAllMountainsExploredBy(String explorerName){
          // Implementation 
      }
  }
  </code></pre>
  
  <p>So any extended class will define only <code>@Transient</code>s in its body. But also I want to allow for situations where the child class is empty: </p>
  
  <pre><code>@Entity
  public class MountainEntity extends MountainEntityBase implements Serializable {
  }
  </code></pre>
  
  <p>Thanks in advance for any help with this.</p>