我正在尝试从我的主持久化类中的其他表中获取表字段,因此我可以使用它来@HbnContainer表。
IND.RECEIVER_ID = KONT.ID
联接很简单
表:
INDEM IND,
KONTR KONT
@Entity (name = "Indem")
@Table(name = "INDEMN", schema="DES")
public class HealthIndemnity {
@Id
@Column(name = "id")
@SequenceGenerator(name="SEQ_STORE", sequenceName="MAINSEQ", schema="SET", allocationSize=1 )
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_STORE")
private Long id;
@OneToOne
@JoinColumn(name = "RECEIVER_ID")
private Counterparty Counterparty;
public Counterparty getCounterparty() {
return Counterparty;
}
public void setCounterparty(Counterparty counterparty) {
Counterparty = counterparty;
}
}
AND
@Entity (name = "Counterparty")
@Table(name = "KONTRAHENTAS_T", schema="KONTRAHENTAS")
public class Counterparty{
@Id
@Column(name = "id")
@SequenceGenerator(name="SEQ_STORE", sequenceName="MAINSEQ", schema="SET", allocationSize=1 )
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_STORE")
private Long id;
@OneToOne
@PrimaryKeyJoinColumn
private HealthIndemnity HealthIndemnity;
@Column(name ="PILN_PAVADINIMAS_AGR")
private String pilnPavadinimasAgr;
public String getPilnPavadinimasAgr() {
return pilnPavadinimasAgr;
}
public void setPilnPavadinimasAgr(String pilnPavadinimasAgr) {
this.pilnPavadinimasAgr = pilnPavadinimasAgr;
}
public Long getId() {
return id;
}
public HealthIndemnity getHealthIndemnity() {
return HealthIndemnity;
}
public void setHealthIndemnity(HealthIndemnity healthIndemnity) {
HealthIndemnity = healthIndemnity;
}
public void setId(Long id) {
this.id = id;
}
}
我怎样才能将其他持久性的字段pilnPavadinimasAgr变为第一个持久性,所以我将它与第一个实体一起使用。
感谢有帮助的答案保证