Сделал себе таким образом:
private ArrayList<HashMap<String, Object>> resultSetToArrayList(ResultSet rs) throws SQLException {
ResultSetMetaData md = rs.getMetaData();
int columns = md.getColumnCount();
ArrayList<HashMap<String, Object>> list = new ArrayList<>();
while (rs.next()) {
HashMap<String, Object> row = new HashMap<>(columns);
for (int i = 1; i <= columns; ++i) {
row.put(md.getColumnName(i), rs.getObject(i));
}
list.add(row);
}
return list;
}
ArrayList<HashMap<String, Object>> list = resultSetToArrayList(rs);
for (HashMap<String, Object> row : list) {
System.out.println(row.get("id"));
System.out.println(row.get("name"));
}