How can i refer my child object to it's parent which are annotated with @MappedSuperclass? These are my classes:
@MappedSuperclass
public class Person extends BaseEntity {}
@Entity
@Table(name = "employee", catalog = "enrollment_system", uniqueConstraints =
@UniqueConstraint(columnNames = {"reference", "emp_number"}))
public class Employee extends Person implements Serializable{}
@MappedSuperclass
public class BackGroundHistory extends BaseEntity {
@ManyToOne
@JoinColumn(name = "person_id")
@ForeignKey(name = "fk_person_history")
private Person person;
}
@Entity
@Table(name = "educational_history", catalog = "enrollment_system")
public class EducationalHistory extends BackGroundHistory implements java.io.Serializable {}
and during run time, i am getting this error:
Exception in thread "main" org.hibernate.AnnotationException: @OneToOne or @ManyToOne on entities.EducationalHistory.person references an unknown entity: entities.Person
I am doing this, to avoid multiple declaration on BackGroundHistory
class since aside from, class Employee
I also have class Applicant
and class Student
.