0

選択の結果を別のテーブルと結合する HQL クエリを作成しようとしています。私が現在持っているのは

SELECT e FROM Experience e JOIN (SELECT f FROM Follow f WHERE f.username = :username AND f.contentType = :contentType) AS A ON (e.experienceId = A.contentId);

現在機能している SQL の同等物は

SELECT t_experiences.* FROM t_experiences JOIN (SELECT * FROM t_follows WHERE t_follows.username = :username AND t_follows.content_type = :contentType) AS A ON (t_experiences.experience_id = A.content_id);

t_experiences.experience_idは などと同等です。HQLExperience.experienceIdの現在のエラーは、エラーのある最初の(ものunexpected token: (です。

どんな助けでも大歓迎です!

4

1 に答える 1

0

これを試してみませんか:

SELECT e.experienceId FROM Experience e, Follow f WHERE f.username = :username AND f.contentType = :contentType AND (e.experienceId = f.contentId);

これはあなたのために働くべきだと思います。

Note: Replace e.experienceId by parameters which you want.

于 2013-06-11T09:38:47.493 に答える