Hello,
I have a HQL with a LEFT JOIN FETCH with an extra condition:
Code:
SELECT a FROM A a LEFT JOIN FETCH a.bs b WITH b.FinalDate is null
It worked really fine without FETCH, but when I put it (and I really need it) it throws QuerySintaxException:
Quote:
with-clause not allowed on fetched associations; use filters
First of all, the other solution:
Code:
SELECT a FROM A a LEFT JOIN FETCH a.bs b WHERE b.FinalDate is null
It's not the same query, because the where clause filter the collection after the join, and of course the results are wrong.
The only workaround I think is using WITH clause without fetch and then iterate the results for getting the bs element manually, but this is really dirty.
I see the documentation (not really much to read about with-clause) and another similar topics, but nothing about how to solve this problem.
Anyone can bring me some light?
Thanks a lot and excuse my english
[postgresql 8.2 and hibernate 3.3.0 ga.]