I can now reply my own question in case anyone need to achieve the same.
This call will retrieve a list of 3 dimensional Object array containing respectively countries, quantity of orders and sum of orders, per country, only including valid orders (ord.getPaidTimeD()) and for a given month back in time. The resulting Object list contains the 3 SELECT items, here String, Integer and Double.
Its very nice to get all that in one single query, this call is used for a pie chart.
public static List<Object[]> getOrdersPerCountry4Month(int monthBack) {
int i=0; //NOTE : monthBack is a negative integer
Calendar now = new GregorianCalendar(TimeZone.getTimeZone("UTC+01:00")).getInstance();
Calendar to = (GregorianCalendar) now.clone();
to.add(Calendar.MONTH, monthBack + 1);
to.set(to.get(Calendar.YEAR), to.get(Calendar.MONTH), 1);
if (to.after(now)) {to = now;}
Calendar from = (GregorianCalendar) now.clone();
from.add(Calendar.MONTH, monthBack);
from.set(from.get(Calendar.YEAR), from.get(Calendar.MONTH), 1);
Query q2 = em.createQuery("SELECT "
+ "ord.getCountry(),"
+ "COUNT(ord),"
+ "SUM(ord.getAmountPaid()) "
+ "FROM OrderData ord "
+ "WHERE ord.getPaidTimeD() "
+ "BETWEEN :fromD AND :toD "
+ "GROUP BY ord.getCountry() ");
q2.setParameter("fromD", from.getTime());
q2.setParameter("toD", to.getTime());
List<Object[]> res = q2.getResultList();
for (Object[] ord2 : res){
System.out.printf("%s\t%d\t%.1f\n",ord2[0],ord2[1],ord2[2]);
i+=1;
}
return res;
}