How can I provide a relationship between two derived class from the same class on hibernate.
I have a class named BaseEntity and it has some attributes that every derived class will have too, such as updateDate,updateID.
And I have two classes derived from that BaseClass named Salary and Employee. And those classes must have a relationship between them which is one-to-one. How can I accomplish that? I have been reading about Hibernate but I haven't seen anything related to this, or I am thinking in a totally wrong way.
It is simple.You can declare a salary variable in Employee class and annotate it with @OneToOne
annotation.
@OneToOne
private Salary salary;