title: How to fetch entire row as array of objects with JDBC
body: <p>I have to make a 'query' method for my class which accesses MySQL thru' JDBC.</p>
  
  <p>The input parameter to the method is a full SQL command (with values included), so I don't know the names of columns to fetch out.</p>
  
  <p>Some of the columns are strings, some others are integers, etc.</p>
  
  <p>The method needs to return the value of type <code>ArrayList&lt;HashMap&lt;String,Object&gt;&gt;</code>
  where each HashMap is 1 row, and the ArrayList contains all rows of result.</p>
  
  <p>I'm thinking of using <code>ResultSet.getMetaData().getColumnCount()</code> to get the number of columns then fetch cell by cell out of the current row, but is this the only solution? any better ones?</p>