title: Spring 3.x + SimpleJdbcTemplate : Returning multiple columns
body: <p>I am using <code>SimpleJdbcTemplate</code> with <code>Spring 3.x</code>. For getting a single column, I use the below code and it works fine:</p>
  
  <pre><code>public String selectSingleColumn(int deptId){
      return jdbcTemplate.queryForObject("SELECT DEPT_NAME FROM DEPT WHERE DEPT_ID = ?", String.class, deptId);
  }
  </code></pre>
  
  <p><strong>Problem:</strong></p>
  
  <p>I want to fetch multiple columns such as <code>DEPT_NAME</code> and <code>DEPT_CODE</code> from that above table (but not all that belong to the table), how to modify the above code to get it done? I am confused with the <code>second parameter</code> of the <code>queryForObject</code> in this case; ideally I think it should be <code>Object[]</code> but stilll confused. Please guide me.</p>