You cannot use a result_variable from the SELECT clause (in your example, usr) in the GROUP BY clause.
Please see JPA 2.1, Section 4.14 BNF.