Here's my HQL query
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)
)
)
I get
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: ( near line 1, column 190
which is the "(" at the begining of the fourth line above.
( SELECT DISTINCT acteurInterne
Hibernate documentation states that sub-queries are allowed only in the SELECT or WHERE clause.
But in the example above you have a subquery in the FROM clause of the first subquery.
Have you tried consolidating the 2 sub-queries into one?