0
我hava兩個實體:PhisicalPerson(PP),JuredicalPerson(JP)。我想創建電話對象。 JP有很多電話,PP有很多電話(一對多關係)。因此,在Phone對象中,我必須爲此關係創建2列:什麼表結構使用(冬眠)
class Phone {
@JoinColumn(name="ppId",nullable=true)
@ManyToOne
public PhisicalPerson getPhisicalPerson() {...}
@JoinColumn(name="jpId",nullable=true)
@ManyToOne
public JuredicalPerson getJuredicalPerson() {...}
// number, city code, additional number and other fields
}
它是否正確實施?或者創建不同的實體可能更好:PhisicalPersonPhone和JuredicalPersonPhone?