Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 意外标记:(子查询hql)_Sql_Hibernate_Hql - Fatal编程技术网

Sql 意外标记:(子查询hql)

Sql 意外标记:(子查询hql),sql,hibernate,hql,Sql,Hibernate,Hql,这是我的HQL查询 FROM com.mysite.ActeurInterne act WHERE act.acteurId IN (SELECT DISTINCT COALESCE(acteurInterne.acteurInternePrincipalId, acteurInterne.acteurId) FROM (SELECT DISTINCT acteurInterne FROM com.mysite.ActeurInterne AS acteurInterne JOIN

这是我的HQL查询

FROM com.mysite.ActeurInterne act WHERE act.acteurId IN
(SELECT DISTINCT COALESCE(acteurInterne.acteurInternePrincipalId, acteurInterne.acteurId)
FROM
  (SELECT DISTINCT acteurInterne
  FROM com.mysite.ActeurInterne AS acteurInterne
  JOIN acteurInterne.roleSet.roles                                     AS role
  WHERE acteurInterne.acteurId = acteurInterne.acteurId
  AND acteurInterne.nom LIKE :likenom
  AND (role.dateFermeture IS NULL
  OR role.dateFermeture   >= TRUNC(SYSDATE))
  AND (role.dateOuverture IS NULL
  OR role.dateOuverture   <= TRUNC(SYSDATE))
  AND (role.type           = :type
  OR role.type             = :typeC)
  )
)
这是上面第四行的开头


SELECT DISTINCT ACTEURInter

Hibernate文档说明仅在SELECT或WHERE子句中允许子查询

请注意,HQL子查询只能出现在select或where中 条款

但在上面的示例中,在第一个子查询的FROM子句中有一个子查询

您是否尝试过将两个子查询合并为一个子查询

FROM com.mysite.ActeurInterne act WHERE act.acteurId IN
(SELECT DISTINCT COALESCE(acteurInterne.acteurInternePrincipalId, acteurInterne.acteurId)
  FROM com.mysite.ActeurInterne AS acteurInterne
  JOIN acteurInterne.roleSet.roles                                     AS role
  WHERE acteurInterne.acteurId = acteurInterne.acteurId
  AND acteurInterne.nom LIKE :likenom
  AND (role.dateFermeture IS NULL
  OR role.dateFermeture   >= TRUNC(SYSDATE))
  AND (role.dateOuverture IS NULL
  OR role.dateOuverture   <= TRUNC(SYSDATE))
  AND (role.type           = :type
  OR role.type             = :typeC)
)

谢谢您的回答。为了完整起见,您能告诉我一个解决方案来实现FROM[子查询]吗?
FROM com.mysite.ActeurInterne act WHERE act.acteurId IN
(SELECT DISTINCT COALESCE(acteurInterne.acteurInternePrincipalId, acteurInterne.acteurId)
  FROM com.mysite.ActeurInterne AS acteurInterne
  JOIN acteurInterne.roleSet.roles                                     AS role
  WHERE acteurInterne.acteurId = acteurInterne.acteurId
  AND acteurInterne.nom LIKE :likenom
  AND (role.dateFermeture IS NULL
  OR role.dateFermeture   >= TRUNC(SYSDATE))
  AND (role.dateOuverture IS NULL
  OR role.dateOuverture   <= TRUNC(SYSDATE))
  AND (role.type           = :type
  OR role.type             = :typeC)
)