In JPQL, I can retrieve entities by :
query = entityManager.createQuery("select c from Category c");
List<Category> categories = query.getResultList();
But, if I wish to retrieve the id and name fields (only) of the Category entity, I need something like the ResultSet object, through which I can say : rs.getString("name") and rs.getString("id"). How to do this through JPQL, without retrieving the entire entity ?
Basically, for a how to retrieve information from a query like : select c.id,c.name from Category c ?