1つのSQLステートメントのみを実行する場合は、ResultSetExtractor
を使用できます。public class SelectItemResultSetExtractor implements ResultSetExtractor<LinkedHashMap<String, List<SelectItem>>>{
public LinkedHashMap<String, List<SelectItem>> extractData(ResultSet rs) throws SQLException,
DataAccessException {
LinkedHashMap<String, List<SelectItem>> result = new ...
//put the 3 categories with empty arraylists
while(rs.next()){
SelectItem item= new SelectItem();
item.setRoleid(rs.getInt(1))
item.setFirstName(rs.getInt(2));
item.setLastName(rs.getString(3));
//if item.getRoleid() is ProjManager
// then put in the list of the ProjManager
result.get("ProjManager").add(item);
//if item.getRoleid() is ResourceOwnerSE
// then put in the list of the ResourceOwnerSE
...
}
return result;
}
}