我正在尝试创建一个 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);
wheret_experiences.experience_id
等价于Experience.experienceId
等。HQL 中的当前错误是第一个(
有unexpected token: (
错误的。
任何帮助将不胜感激!