Unknown state or association field exception
I meet the above exception on my project, but not know where my problem lies. Please help. Thank you.
Here is the exception message:
Exception Description: Unknown state or association field [projectNoSub] of class [database.SfcWip].
Here is the entity class:
@Entity
@Table(name = "SFC_WIP")
@NamedQueries( {
@NamedQuery(name = "SfcWip.findByProjectNoSub", query = "SELECT s FROM SfcWip s WHERE s.sfcWipPK.projectNoSub = :projectNoSub"),
@NamedQuery(name = "SfcWip.findByPcbPartNo", query = "SELECT s FROM SfcWip s WHERE s.sfcWipPK.pcbPartNo = :pcbPartNo"),
@NamedQuery(name = "SfcWip.findByPcbQty", query = "SELECT s FROM SfcWip s WHERE s.pcbQty = :pcbQty"),
@NamedQuery(name = "SfcWip.findByFlowId", query = "SELECT s FROM SfcWip s WHERE s.flowId = :flowId"),
@NamedQuery(name = "SfcWip.findByStatus", query = "SELECT s FROM SfcWip s WHERE s.status = :status"),
@NamedQuery(name = "SfcWip.findByRemarks", query = "SELECT s FROM SfcWip s WHERE s.remarks = :remarks")
})
public class SfcWip implements Serializable {
/**
* EmbeddedId primary key field
*/
@EmbeddedId
protected SfcWipPK sfcWipPK;
@Column(name = "PCB_QTY")
private BigDecimal pcbQty;
@Column(name = "FLOW_ID")
private String flowId;
@Column(name = "STATUS")
private String status;
@Column(name = "REMARKS")
private String remarks;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "sfcWip")
private Collection<SfcWiptran> sfcWiptranCollection;
/** Creates a new instance of SfcWip */
public SfcWip() {
}
public SfcWip(SfcWipPK sfcWipPK) {
this.sfcWipPK = sfcWipPK;
}
public SfcWip(String pcbPartNo, String projectNoSub) {
this.sfcWipPK = new SfcWipPK(pcbPartNo, projectNoSub);
}
public SfcWipPK getSfcWipPK() {
return this.sfcWipPK;
}
public void setSfcWipPK(SfcWipPK sfcWipPK) {
this.sfcWipPK = sfcWipPK;
}
public BigDecimal getPcbQty() {
return this.pcbQty;
}
public void setPcbQty(BigDecimal pcbQty) {
this.pcbQty = pcbQty;
}
public String getFlowId() {
return this.flowId;
}
public void setFlowId(String flowId) {
this.flowId = flowId;
}
public String getStatus() {
return this.status;
}
public void setStatus(String status) {
this.status = status;
}
public String getRemarks() {
return this.remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public Collection<SfcWiptran> getSfcWiptranCollection() {
return this.sfcWiptranCollection;
}
public void setSfcWiptranCollection(Collection<SfcWiptran> sfcWiptranCollection) {
this.sfcWiptranCollection = sfcWiptranCollection;
}
@Override
public int hashCode() {
int hash = 0;
hash += (this.sfcWipPK != null ? this.sfcWipPK.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof SfcWip)) {
return false;
}
SfcWip other = (SfcWip)object;
if (this.sfcWipPK != other.sfcWipPK && (this.sfcWipPK == null || !this.sfcWipPK.equals(other.sfcWipPK))) return false;
return true;
}
@Override
public String toString() {
return "database.SfcWip[sfcWipPK=" + sfcWipPK + "]";
}
}
@Embeddable
public class SfcWipPK implements Serializable {
@Column(name = "PROJECT_NO_SUB", nullable = false)
private String projectNoSub;
@Column(name = "PCB_PART_NO", nullable = false)
private String pcbPartNo;
/** Creates a new instance of SfcWipPK */
public SfcWipPK() {
}
public SfcWipPK(String pcbPartNo, String projectNoSub) {
this.pcbPartNo = pcbPartNo;
this.projectNoSub = projectNoSub;
}
public String getProjectNoSub() {
return this.projectNoSub;
}
public void setProjectNoSub(String projectNoSub) {
this.projectNoSub = projectNoSub;
}
public String getPcbPartNo() {
return this.pcbPartNo;
}
public void setPcbPartNo(String pcbPartNo) {
this.pcbPartNo = pcbPartNo;
}
@Override
public int hashCode() {
int hash = 0;
hash += (this.pcbPartNo != null ? this.pcbPartNo.hashCode() : 0);
hash += (this.projectNoSub != null ? this.projectNoSub.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof SfcWipPK)) {
return false;
}
SfcWipPK other = (SfcWipPK)object;
if (this.pcbPartNo != other.pcbPartNo && (this.pcbPartNo == null || !this.pcbPartNo.equals(other.pcbPartNo))) return false;
if (this.projectNoSub != other.projectNoSub && (this.projectNoSub == null || !this.projectNoSub.equals(other.projectNoSub))) return false;
return true;
}
@Override
public String toString() {
return "database.SfcWipPK[pcbPartNo=" + pcbPartNo + ", projectNoSub=" + projectNoSub + "]";
}
}

