Is there any way to cast a JDBC ReultSet to an ArrayList of Strings
(or another type of DTO) with a single assignment statement?
Otherwise I end up iterating through the ResultSet twice - once on the
server to assign its values to an ArrayList of DTOs - and once after
its returned to the client in order to display the results. I'd rather
just assign (cast) the resultSet to the ArrayList and return it. For
example:
Rather than do this on the server:
resultSet = statement.executeQuery("SELECT first_name from
Employees");
while (resultSet.next()) {
arrayList.add(resultSet.getString("first_name")); //Loops through
over a hundred records
}
return arrayList;
It would be nice to simply do this:
resultSet = statement.executeQuery("SELECT first_name from
Employees");
arrayList = (ArrayList<Names>) resultSet; //Assign the entire
resultSet to the ArrayList
return arrayList;
Is this (or something similar) possible?
Thanks in advance,
-Russ
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.