title: Hibernate Mapped Superclass relationships and overriding
body: <p>I have an abstract MappedSuperClass, Participant, which is extended by three kinds of 'Participant'. Each one then uses its own kind of 'Project', also an abstract MappedSuperClass. However, I want the base class to know about Projects so I can write generic code to interact with Participants. How do I specify this using Hibernate annotations? and how will I override it in the ExtendedParticipant and ExtendedProject classes?</p>
  
  <p>Each Participant type, and each Project type, have their own database tables with existing data and ids (not unique across tables) that I cannot change.</p>
  
  <p>The following code gives me the IDE error "Many to one attribute should not be 'Mapped Superclass'".</p>
  
  <pre><code>@MappedSuperclass
  public abstract class Participant implements Persistable {
  
      ...
  
      @ManyToOne
      @JoinColumn(name = "project_id")
      public Project getProject() {
          return project;
      }
  
      public void setProject(Project project) {
          this.project = project;
      }
  
      ...
  }
  </code></pre>
  
  <p>and the Project class is much the same with the same problem:</p>
  
  <pre><code>@MappedSuperclass
  public abstract class Project implements Persistable {
  
      ...
  
      @OneToMany
      public List&lt;Participant&gt; getParticipants() {
          return participants;
      }
  
      public void setProject(List&lt;Participant&gt; participants) {
          this.participants = participants;
      }
  
      ...
  }
  </code></pre>