TypedQuery<UserNameAndPostCount> query = entityManager.createQuery(
"select new com.loki2302.JPQLTest$UserNameAndPostCount" +
"(u.userName, count(p.id)) " +
"from User u " +
"left join u.posts p group by u.userName", UserNameAndPostCount.class);
List<UserNameAndPostCount> resultList = query.getResultList();
com.loki2302.JPQLTest$UserNameAndPostCount
在 JPQL 查询文本中没有硬编码的情况下是否有任何“官方”方式可以做到这一点?