Hi I have a hibernate query which is giving me a list with type List<List<integer>>.
How can I iterate this? My hibernate query is:
String SQL_QUERY = "select DISTINCT cbl.franchiseId,cbl.resellerId from
CustomerBusinessLocation cbl where cbl.cmcustLocId in (:locationId)";
Query query = getSession().createQuery(SQL_QUERY);
query.setParameterList("locationId", customerLocId);
List<List<Integer>> rc_list = query.list();
Alternatively, is there any other way to easily pull in this data?
This query doesn’t return a
List<List<Integer>>. It returns aList<Object[]>. TheObject[]arrays contain one element per requested field. In your case, eachObject[]will containfranchiseIdat index 0 andresellerIdat index 1.This is of course explained in the reference documentation.
The iteration should thus look like this: