i want to get Elements and the amount of certain sub-subelements without actually loading them, i tried this:
f, count(f.themen.responses) FROM Forum f WHERE f.grouping=:group
but i get
node to traverse cannot be null!
how can i archieve something like that?
tanks
You get node to traverse cannot be null!, because you didn't specified SELECT in query. Next problem is that aggregate function (COUNT
) is used in query, but f
is not in GROUP BY
.
Query where both of those problems are fixed is:
SELECT f, count(f.themen.responses)
FROM Forum f WHERE f.grouping=:group
GROUP BY f