public interface CodeRepository extends JpaRepository<Code, Integer> { @Query("select c.code, c.name, count(l) as amount from Code c join c.counterList l group by c.code, c.name") List<Object[]> getSummary(); }