As a workaround you can try counting the id field, so doing a COUNT(f.id) instead of COUNT(f):
SELECT new dto.PersonDTO(res.id,res.firstname,res.surname, count(f))
FROM Person res JOIN res.friends f WHERE res.id=:id
GROUP BY res.id, res.firstname, res.surname
Regards Michael
[Message sent by forum member 'mb124283' (mb124283)]