私は2つのクラスを持っています:
@Entity
@Table(name = "Appeal_Header")
public class AppealHeader implements Serializable {
private static final long serialVersionUID = -8402922611571578104L;
@Id
@Column(name = "Appeal_Header_Key", unique=true, nullable=false)
private long id;
@Column(name = "customer_cd", unique=true, nullable=false)
private String customer;
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="hes_invoice_header_id", insertable=false)
private BillingHeader billingHeader;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public BillingHeader getBillingHeader() {
return billingHeader;
}
public void setBillingHeader(BillingHeader billingHeader) {
this.billingHeader = billingHeader;
}
public String getCustomer() {
return customer;
}
public void setCustomer(String customer) {
this.customer = customer;
}
}
@Entity
@Table(name = "billing_header")
public class BillingHeader implements Serializable {
private static final long serialVersionUID = 503665425710114912L;
@Id
@Column(name="hes_invoice_header_id", insertable=false, updatable=false)
private long id;
@Column(name="claim_number", insertable=false, updatable=false, unique=false)
private String claimNumber;
@OneToMany(cascade={CascadeType.ALL})
@JoinColumn(name="hes_invoice_header_id", insertable=false, updatable=false)
private List<AppealHeader> appealHeader;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getClaimNumber() {
return claimNumber;
}
public void setClaimNumber(String claimNumber) {
this.claimNumber = claimNumber;
}
public List<AppealHeader> getAppealHeader() {
return appealHeader;
}
public void setAppealHeader(List<AppealHeader> appealHeader) {
this.appealHeader = appealHeader;
}
}
public void exececute() {
Criteria criteria = session.createCriteria(AppealHeader.class);
if(!"".equals(form.getCustomer()))
criteria.add(Restrictions.eq("customer",form.getCustomer()));
if(!"".equals(form.getClaimNumber()))
criteria.add(Restrictions.eq("billingHeader.claimNumber",form.getClaimNumber()));
}
今、私はこの条件クエリを実行しています:
顧客ごとにクエリを実行すると、すべてのアピール ヘッダー レコードと関連する請求ヘッダーが返されます。しかし、顧客とbillingHeader.claimNumberだけでbillingHeader.claimNumberだけをクエリするとします。私はこの例外を受け取ります:
Exception: org.hibernate.QueryException: could not resolve property: billingHeader.claimNumber of: healthe.appeals.model.AppealHeader
誰か助けてくれませんか??