I'm trying to find out if it is possible to do the following HQL using the Hibernate Criteria API:
String hql = "select new InitialCount(substring(name, 1,1), count(id)) from Person group by substring(name, 1,1)";
Where InitialCount is a very simple bean with a string and long contructor:
public static class InitialCount {
private final String initial;
private final long count;
public InitialCount(String initial, long count) {
this.initial = initial;
this.count = count;
}
}
Is it possible?