I have a HashSet of strings, the size of the hashset is variable it can contain 10 strings or 10.000 it depends on the user that fills the list. Now I have to make a sql statement with the strings from the list where I get some information back from the database this is how I do it right now:
for (Iterator<String> iter = currentStrings.iterator(); iter
.hasNext();) {
ResultSet rs = entPermission.sql
.executeQuery("select name from table join table_access "
+ "on table_access.access_granted_to=table.id"
+ " join table on table.id=table_access.name_id"
+ " where table.name='"
+ iter.next() + "'");
while (rs.next()) {
String informations = rs.getString("name");
informationList.add(informations);
}
}
So what I do now is send a request for the information for every single string in the HashSet so as you can understand it can take a while till I get the results of 10.000 strings. Is there a better (faster) way to go through the 10.000 strings without making a select statement for every single one of them?