我有一个MySql
这样的查询:
select AK.*, max(AA.activityDate)
from AssessmentKey AK
join AssessmentActivity AA on AA.ASSESSMENTKEY_ID = AK.id
group by AK.id having max(AA.activityDate) <= '2012-10-02 17:30:55'
有没有办法转换成 in JPA
NamedQuery
. 我正在使用OpenJPA
.
如果我直接放入:
@NamedQuery(name = "AssessmentActivity.findByDate",
query = "select AK.*, max(AA.activityDate) from AssessmentKey AK
join AssessmentActivity AA on AA.ASSESSMENTKEY_ID = AK.id
group by AK.id having max(AA.activityDate) <= '2012-10-02 17:30:55'")
错误显示在这里:select AK.*
那identifier expected, got "*"
也不喜欢on
,这里说:
我该如何解决这个问题?