I have two classes Team and User :
@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;
And
@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;
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 :
org.hibernate.AnnotationException: @OneToOne or @ManyToOne on Match.participantFirst references an unknown entity: Participant
@MappedSuperclass
public interface Participant {
}