title: Get Bean instead of List object using Jdbctemplate and Rowmapping
body: <p>I'm trying to fetch a result set and cast it to the Bean. Its not working. But then I tried to cast to List of beans, and it works. Can any one tell me how can I directly get a Bean object using Jdbctemplate and Rowmapping.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>String sql = "SELECT * FROM BB.Employeeswhere " +
              "BBEmpPK = ? ";
  
  List&lt;EmployeeDto&gt; deals = (List&lt;EmployeeDto&gt;) getJdbcTemplate().query(
              sql,
              new Object[] {empId},
              new RowMapper&lt;EmployeeDto&gt;() {
                  public EmployeeDtomapRow(ResultSet rs, int rowNum) throws SQLException {
                      EmployeeDto d = new EmployeeDto();
                      d.setEmpName(rs.getString(2));                     
                      return d;
                  }
              });
  </code></pre>
  
  <p>Ideally this should return only one row. Any ideas?</p>
  
  <p>If there is any other solution without row mapper, that will be even good. Because in the table, I have 50+ columns, so it would be difficult to create a Bean with those fields</p>