The JPA specification requires that the access type of the Embeddable is
interpreted to be the access type of the owner. In this case the owner
uses property access and so EclipseLink must process the Embeddable
using property access. The case of the property "lineOfBusiness" is not
the same as the JPQL property name you are using "lineofBusiness". You
can change your JPQL or change the access type of the parent.
--Gordon
khaskett wrote:
Currently getting this message in my server logs when try to run a JPQL
query-
Caused by: Exception [EclipseLink-8030] (Eclipse Persistence Services -
1.1.0.r3634): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Error compiling the query [SELECT model FROM
Zdk01cntlf AS model WHERE model.lineofBusiness = :lineofBusiness AND
model.state = :state AND model.type = :type AND model.reasonCode =
:reasonCode ORDER BY model.effectiveDate ASC ], line 1, column 50:
unknown
state or association field [lineofBusiness] of class
[com.xxx.jpa.domain.Zdk01cntlf].
Here is the code I am executing -
final String queryString = "SELECT model FROM Zdk01cntlf AS model WHERE
model.lineofBusiness =
:lineofBusiness AND model.state = :state AND model.type = :type AND
model.reasonCode = :reasonCode
ORDER BY model.effectiveDate ASC ";
final Query query = getEntityManager().createQuery(queryString);
The entity looks like this -
@Entity
@Table(name = "ZDK01CNTLF", schema = "GNDATA")
public class Zdk01cntlf implements Serializable {
private Zdk01cntlfId id;
private String effectiveDate;
private String numberofDays;
public Zdk01cntlf() {
super();
}
@EmbeddedId
public Zdk01cntlfId getId() {
return id;
}
public void setId(Zdk01cntlfId id) {
this.id = id;
}
@Column(name = "CNT_REF_FILE_EFF_DT")
public String getEffectiveDate() {
return this.effectiveDate;
}
public void setEffectiveDate(String effectiveDate) {
this.effectiveDate = effectiveDate;
}
@Column(name = "CNT_REF_FILE_DAYS_NOT")
public String getNumberOfDays() {
return this.numberofDays;
}
}
And the EmbeddedId looks like -
@Embeddable
public class Zdk01cntlfId implements Serializable {
private String lineofBusiness;
private String state;
private String type;
private String reasonCode;
/** default constructor */
public Zdk01cntlfId() {
}
public Zdk01cntlfId(String lineofBusiness, String state, String type,
String reasonCode) {
super();
....
}
// Property accessors
@Column(name = "CNT_REF_FILE_LINE")
public String getLineOfBusiness() {
return this.lineofBusiness;
}
public void setLineOfBusiness(String lineofBusiness) {
this.lineofBusiness = lineofBusiness;
}
@Column(name = "CNT_REF_FILE_STATE")
public String getState() {
return this.state;
}
public void setState(String state) {
this.state = state;
}
@Column(name = "CNT_REF_FILE_CAN_TYPE")
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
@Column(name = "CNT_REF_FILE_CAN_REASON")
public String getReasonCode() {
return this.reasonCode;
}
public void setReasonCode(String reasonCode) {
this.reasonCode = reasonCode;
}
.... hashCode and Equals ommitted
This has just started showing up since we moved from 1.0.2 to 1.1
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users