I am using createQuery function in my application. below is the sample code.
String test = "select t.name,t.descr,t.category from Test t where t.companyId=companyId";
List<Object[]> object = entityManager.createQuery(hql.toString())
.setParameter("companyId", 9001).getResultList();
So as of now response coming in list of objects. columns names are not coming in response , directly values are coming.
i need response in key value pair, something like that below sample.. if three rows coming from query then response should be
{"name":"test","descr":"test descr", "category":"test category"}
{"name":"test","descr":"test descr", "category":"test category"}
{"name":"test","descr":"test descr", "category":"test category"}
Actually query will be coming dynamically in createQuery method, that's why i don't know what are the columns will be there in query.
That's why i need response in key value pair.