我有我查看(2 个表和 1 个关联)并且我像这样映射它
@Id
@Column(name = "IDBQ", precision = 5, scale = 0)
public Integer getIdbq() {
return this.idbq;
}
public void setIdbq(Integer idbq) {
this.idbq = idbq;
}
@Column(name = "IDR", precision = 22, scale = 0)
public Integer getIdr() {
return this.idr;
}
public void setIdr(Integer idr) {
this.idr = idr;
}
@Column(name = "NOM_CLIENT", length = 100)
public String getNomClient() {
return this.nomClient;
}
public void setNomClient(String nomClient) {
this.nomClient = nomClient;
}
@Column(name = "PRENOM_CLIENT", length = 30)
public String getPrenomClient() {
return this.prenomClient;
}
并且因为它是一个视图,许多行中的主键IDBQ是重复的。当我从hibernate发出请求hql时,它返回的问题是:重复的行有重复的Id - > IDBQ
如果我有 :
IDBQ -- IDR -- NOM_CLIENT -- PRENOM_CLIENT
1 1 xx xxx
1 2 yy yyy
它在我的 hql 请求中返回我
1 1 xx xxx
1 1 xx xxx
但 sql 请求工作正常!