Here you can find the source of getMap(ResultSet resultSet)
public static Map<String, Object> getMap(ResultSet resultSet)
//package com.java2s; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, Object> getMap(ResultSet resultSet) { Map<String, Object> valueMap = new HashMap<String, Object>(); try {/*from w w w . j a va 2s . co m*/ ResultSetMetaData metaData = resultSet.getMetaData(); int columnCount = metaData.getColumnCount(); for (int j = 1; j <= columnCount; j++) { valueMap.put(metaData.getColumnLabel(j), resultSet.getObject(j)); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return valueMap; } }