Hello,
I'm writing complex query and I need to use correlated subquery with fetching but i'm getting
"org.hibernate.QueryException: fetch not allowed in subquery from-elements"
Here is my query:
Code:
SELECT t FROM Transmission t
JOIN FETCH t.parent
JOIN FETCH t.parent.course
JOIN FETCH t.year.sem
WHERE t.if_active = 'N' AND t.year = :P_YEAR AND 1 > (
select count(*)
FROM Instances act
JOIN FETCH act.transmission
JOIN FETCH act.transmission.parent
JOIN FETCH act.year
JOIN FETCH act.year.sem
WHERE act.nr = :P_NR
AND act.transmission.parent.emp = t.parent.emp
AND act.year.sem = t.year.sem
)
I would be grateful for any help.
Thanks in advance.