I want to return a HashMap from JPA query like the below but I don\'t know how to fill the HashMap from this query. Actually I want to fill charts from HashMap in the fronte
Please refer, JPA 2.0 native query results as map
In your case in Postgres, it would be something like,
List list = em.createNativeQuery("select cast(json_object_agg(count(i.uuid),i.username) as text) from schema.information i where i.entereddt between :start and :end group by i.username")
.setParameter("start",new Timestamp(start.getTime()))
.setParameter("end",new Timestamp(end.getTime()))
.getResultList();
//handle exception here, this is just sample
Map map = new ObjectMapper().readValue(list.get(0), Map.class);
Kindly note, I am just sharing my workaround with Postgres.