title: Using a query inside RowMapper
body: <p>In java i would do something like below to iterate the <code>resultset</code> and form the query,</p>
  
  <pre><code>public Map&lt;String, List&lt;MODEL&gt;&gt; fun(){
  Map&lt;String, List&lt;MODEL&gt;&gt; map = new TreeMap&lt;String, List&lt;MODEL&gt;&gt;();      
          LinkedHashSet&lt;String&gt; set = new LinkedHashSet&lt;String&gt;();
  
              String sql = "select distinct(column) from table where conditions orderby column ";
              ResultSet rslt = stmt.executeQuery(sql);
              while (rslt.next()) {
                  al.add(rslt.getString(1));
              }
              for (String s : al) {           
                  List&lt;MODEL&gt; list = new ArrayList&lt;MODEL&gt;();
                  String sql2 = "select * from table where column="+s;
                  ResultSet rslt2 = stmt.executeQuery(sql2);
                  while (rslt2.next()) {
                      MODEL obj = new MODEL();
                      // set values to setters from resultset
                      list.add(obj);
                  }
                  map.put(s, list);
              }
              return map;
              }
  </code></pre>
  
  <p><em>the reason why i have used the separate query is , i am adding the distinct values to the map key and their corresponding values(as List) to the values of the map .<strong>NOTE</strong> (In the result it has duplicate values of the <strong>column1</strong>)  , But i need to store them as map key and hence making it as unique .
  also i need all its associated values so populating a list</em></p>
  
  <p>How can i achieve the same functionality using <code>JdbcTemplate</code> ,</p>
  
  <p>Thanks in advance     </p>