このエラーでJPAとHibernateと本当に混同しています。
これがスタックの例外です
2012-08-07 03:55:04,277 ERROR [org.hibernate.hql.PARSER] (HDScanner) Path expected for join!
2012-08-07 03:55:04,299 ERROR [org.hibernate.impl.SessionFactoryImpl] (HDScanner) Error in named query: getTotalCallReportsFromQuarter
org.hibernate.QueryException: Unable to resolve path [care.quarter], unexpected token [care] [SELECT count(noOfCallReports) FROM com.business.model.base.CareCallReport JOIN Relationships with CareCallReport.clientAccountNo=Relationships.clientAccountNo where UID = :UID and care.quarter = :quarter and care.year = :year]
これが私が参加することを計画した2つのエンティティです:
CareCallReport.java
@Entity
@Table(name = "CARE_CALLREPORT")
public class ICareCallReport implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Column(name = "ClientAccountNo", nullable = false, length = 7)
private String clientAccountNo;
@Column(name = "NoOfCallReports", nullable = false, length = 11)
private int noOfCallReports;
@Column(name = "Quarter", nullable = false, length = 11)
private int quarter;
@Column(name = "QtrYear", nullable = false, length = 4)
private int year;
... Getters and Setters
そして他の実体
ITRelationships.java
@Entity
@Table(name = "IT_RELATIONSHIPS")
public class ITRelationships implements Serializable {
@Id
@Column(name = "ClientID",nullable = false, length = 7)
private String clientID;
@Column(name = "ClientAccountNo", nullable = false, length = 7)
private String clientAccountNo;
@Id
@Column(name = "UID", nullable = false, length = 6)
private String UID;
@Column(name = "Quarter", nullable = false, length = 11)
private int quarter;
@Column(name = "QtrYear", nullable = false, length = 4)
private int year;
Getters and Setters
私が書いたJQLメソッドはそのようなものでした:
<access>FIELD</access>
<named-query name="getTotalCallReportsFromQuarter">
<query>
<![CDATA[
SELECT count(noOfCallReports)
FROM CareCallReport JOIN ITRelationships
with CareCallReport.clientAccountNo = ITRelationships.clientAccountNo
where UID = :uid
and care.quarter = :quarter
and care.year = :year
]]>
</query>
</named-query>
私は何を間違えましたか?JPAに触れたのはこれが初めてです。