I have 2 tables:
In my GnrlOrgChargeCode.java file, I have:
private Set<IOrgChargeCodeCond> orgChargeCodeConds;
@OneToMany(mappedBy = "gnrlOrgChargeCode", targetEntity = OrgChargeCodeCond.class,
fetch = FetchType.LAZY)
public Set<IOrgChargeCodeCond> getOrgChargeCodeConds() {
return orgChargeCodeConds;
}
public void setOrgChargeCodeConds(Set<IOrgChargeCodeCond> orgChargeCodeConds) {
this.orgChargeCodeConds = orgChargeCodeConds;
}
and in My OrgChargeCodeCond file:
private IGnrlOrgChargeCode gnrlOrgChargeCode;
@ManyToOne(targetEntity = GnrlOrgChargeCode.class,
fetch = FetchType.LAZY)
@JoinColumn(name = "ORG_CHARGE_CODE_ID", insertable=false, updatable=false)
public IGnrlOrgChargeCode getGnrlOrgChargeCode() {
return gnrlOrgChargeCode;
}
public void setGnrlOrgChargeCode(IGnrlOrgChargeCode gnrlOrgChargeCode) {
this.gnrlOrgChargeCode = gnrlOrgChargeCode;
}
and my Hibernate query is:
from GnrlOrgChargeCode gocc left join OrgChargeCodeCond occc where gocc.orgId = ?
but I get an error:
Path expected for join!
Please help. Thanks.
You need a query like from GnrlOrgChargeCode gocc left fetch join gocc.orgChargeCodeConds occc where gocc.orgId =?
. Apart from that, entity joins are supported as of version 5.1. Since you get this error it seems you are using an older version. I would recommend you to update soon as you will most probably not receive any substantial support/help for older versions.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.