次のような複数のエンティティ オブジェクトを返す HQL クエリを作成する必要があります。
/*
* Want to return both H and C in the same query...
*/
SELECT H, C
/*
* ... such that H is the most recent entry...
*
* (Note that 'ON' keyword does not work with HQL)
*/
FROM HealthHistory H INNER JOIN (
SELECT id, MAX(insertion_time) insertion_time
FROM HealthHistory
GROUP BY id
) IH ON H.id = IH.id AND IH.insertion_time = H.insertion_time
/*
* ... while getting these other entities involved...
*/
LEFT JOIN NodeA A
LEFT JOIN NodeC C
LEFT JOIN NodeL L
/*
* ... so we can add some more expressions here...
*/
WHERE A.someId = C.descendant.id -- A -> C
AND A.something = someConstant
AND C.someId = L.id -- C -> L
AND C.something = someConstant
AND L.something = someConstant
AND H.someId = C.id -- H -> C
AND H.something = someConstant
受け続けていますorg.hibernate.hql.ast.QuerySyntaxException: unexpected token: {(, A, ON, or INNER}
多くの同様の質問を調べた後でも、私はかなり長い間苦労してきました。これについての助けをいただければ幸いです...