Click to See Complete Forum and Search --> : How to get values from two resultsets


Madhur
07-11-2007, 07:00 AM
Hi All,
I'm getting two results from DataBase(This is the requirement).
How can i get the value in these result sets into a List in DAO layer.
If some one can explain how to handle two resultsets that would be of
great help.

Thanks in advance ....

Khalid Ali
07-11-2007, 04:31 PM
There is no quick available API from java for this (as far as I am aware of).
You must need to go through each rs and put the contents in a List.

something like this
List rsList = getListFromRS(resultSet);

and then implementation may look like this
while(rs.next()){
list.add(object);
}
if you want this to be completely robust then you need to use resultsetmetadata and find out column names and get value for each column name and put that data in the list.
What I would do here is create a new list object for each row and put that in the list that I would return.