Первая сущность:
@Entity
@Table(name = "POL_STN_MASTER")
public class POL_STN_MASTER implements java.io.Serializable{
@EmbeddedId
private PolStationEmbadedID polStationId;
@Column(name = "POL_STN_NM")
private String polStationName;
//getter and setter
}
EmbededID:
@Embeddable
public class PolStationEmbadedID implements Serializable {
@Column(name = "DIST_CD")
private String distCd;
@Column(name = "SUB_DIV_CD")
private String subDivCD;
@Column(name = "POL_STN_CD")
private String polStnCD;
//getter and setter
}
Следующая сущность:
@Entity
@Table(name = "PRINCIPAL_INFO")
public class Principal_info implements Serializable {
@Id
@Column(name="ENROL_NO")
private String enrolNo;
@Column(name = "DIST_CD")
private String dist_cd;
@Column(name = "SUB_DIV_CD")
private String sub_div_cd;
@Column(name = "POL_STN_CD")
private String pol_st_cd;
@Column(name = "FIRST_NM")
private String f_name;
@Column(name = "MIDDLE_NM")
private String m_name;
@Column(name = "LAST_NM")
private String l_name;
//getter and setter
}
Как мне сопоставить сущности 'POL_STN_MASTER' и 'Principal_info' с PolStationEmbadedID и тремя полями 'dist_cd', 'sub_div_cd' и 'pol_st_cd'?.
Пожалуйста, помогите. Заранее спасибо.