Alexander,
I believe this will work:
hql_query_string = ""
+ "select distinct pers, count(persAccsBOs) as anzBo from Person as pers"
+ " inner join pers.personenAttribute as persAttr inner join persAttr.pa_pk.attribut as pAttr"
+ " inner join pers.accounts as persAccs"
+ " inner join persAccs.berechtigungsobjekte as persAccsBOs"
+ " where pAttr.name= :attrName"
+ " and persAttr.wert= :attrValue"
+ " group by pers"
+ " having count(persAccsBOs) >= :threshold";
Conditions on aggregated fields must be made with the having clause, not inside the where clause.