I have a simple query which is
select distinct roleid,firstname,lastname where role_id='210';
I am using the same query for fetching the different lists such as projectnames ,projectmanagers name,developers...etc..based on the roleid that I am passing.
My problem is I need to run the above query in a single shot by passing all the roleid and retrieve them in a single hit and assign those list to different list such as managers list ,developers list ,testers list ..etc and send it to the UI putting them in a linked hasmap.
Example
LinkedHashMap<String, List<SelectItem>> results = new LinkedHashMap<String, List<SelectItem>>();
List<SelectItem> getProjectManager = getProjectManager(xxx);
List<SelectItem> getResourceOwnerSE = getResourceOwner(yyy);
List<SelectItem> getReqLeadPri = getReqLeadPri(zzz);
results.put("getProjectManager", getProjectManager);
results.put("getResourceOwner", getResourceOwnerSE);
results.put("getReqLeadPri", getReqLeadPri);
return results;
All the above methods getProjectManager(xxx),getResourceOwner(yyy),getReqLeadPri(zzz) runs with same query as mentioned above but passing different roleid xxx,yyy,zzz.
I don't know how to fetch a different list from a single query passing different parameters and assign to the list and return the results.
I am trying to achieve this because the UI is very slow when I try to get the lists individually from UI <-> DB each time when calling the same query passing different parameters each time for fetching different list. Hence, I am trying to get the results in a single shot.
If you want to fir only one sql statement you can use ResultSetExtractor