Converting Result Set to HashMap

/**
* <h2> Converts ResultSet to HashMap of List<String,Object></h2>
* @param row
* @param rs_SubItemType
* @throws SQLException
*/
private static void getHashMap( List<Map<String, Object>> row, ResultSet rs_SubItemType) throws SQLException {
ResultSetMetaData metaData = rs_SubItemType.getMetaData();
int colCount = metaData.getColumnCount();
while (rs_SubItemType.next()) {
Map<String, Object> columns = new HashMap<String, Object>();
for (int i = 1; i <= colCount; i++) {
columns.put(metaData.getColumnLabel(i), rs_SubItemType.getObject(i));
}
row.add(columns);
}
}
view raw Convert.java hosted with ❤ by GitHub