Hi Steve, I just uploaded HHH_1830.zip containing a TestCase. It contains a simple parent-child relationship. (I've made one little mistake with the sample data: child.setParent(parent) is missing, but that's not important for reproducing the bug) The query string is: SELECT p.id, size(descendants) from Parent p left outer join p.children descendants group by p.id. With 4.3.11, the following SQL is being generated and everything is well:
select
parent0_.id as col_0_0_,
count(children1_.parent_id) as col_1_0_
from
Parent parent0_
left outer join
Child children1_
on parent0_.id=children1_.parent_id
group by
parent0_.id
But with 5.2.2, the aforementioned Exception occurs. Please also note that the workaround provided by Marius Capris is working, but produces the following ugly sql: Query: SELECT p.id, size( p.children) from Parent p left outer join p.children descendants group by p.id
select
parent0_.id as col_0_0_,
count(children2_.parent_id) as col_1_0_
from
Parent parent0_
left outer join
Child children1_
on parent0_.id=children1_.parent_id,
Child children2_
where
parent0_.id=children2_.parent_id
group by
parent0_.id
I hope this helps hunting that bug. Regards Matthias |