title: Hibernate entities abstraction
body: <p>I have two classes Team and User :</p>
  
  <pre><code>@Entity
  @Table(name = "team")
  @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
  public class Team  extends AbstractAuditingEntity implements Serializable, Participant {
  
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
      @SequenceGenerator(name = "sequenceGenerator")
      private Long id;
  </code></pre>
  
  <p>And</p>
  
  <pre><code> @Entity
      @Table(name = "user")
      @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
      @org.springframework.data.elasticsearch.annotations.Document(indexName = "user")
      public class User extends AbstractAuditingEntity implements Serializable, Participant {
  
          private static final long serialVersionUID = 1L;
  
          @Id
          @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
          @SequenceGenerator(name = "sequenceGenerator")
          private Long id;
  </code></pre>
  
  <p>I want to create new entity Match. Match can have 2 participants. Participant can be team or user. I want to create abstraction so i can add team or user to match as participant. I wanted to create Interface Participant and map it with @MappedSuperclass and then Team and User to implement Participant but i got error :  </p>
  
  <blockquote>
    <p>org.hibernate.AnnotationException: @OneToOne or @ManyToOne on
    Match.participantFirst references an unknown entity: Participant</p>
  </blockquote>
  
  <pre><code>@MappedSuperclass
  public interface Participant {
  
  }
  </code></pre>