Getting List<String> using Spring JdbcTemplate
<p>I want to fetch a list of <code>String</code> objects from database using Spring <code>JdbcTemplate</code>:</p>

<p>This works:</p>

<pre><code>List&lt;String&gt; myList = this.logJdbcTemplate.query(this.dbQuery, new Object[] {this.someKey}, new RowMapper() {
    public Object mapRow(ResultSet resultSet, int i) throws SQLException {
        return resultSet.getString(1);
    }
});
</code></pre>

<p>with <code>myList</code> containing the <code>Strings</code> returned from database.</p>

<p>However, the none of the following work:</p>

<pre><code>List&lt;String&gt; myList = this.logJdbcTemplate.query(this.dbQuery, new Object[] {this.someKey}, new BeanPropertyRowMapper(String.class));

List&lt;String&gt; myList = this.logJdbcTemplate.query(this.dbQuery, new Object[] {this.someKey}, new BeanPropertyRowMapper&lt;String&gt;(String.class));

List&lt;String&gt; myList = (List&lt;String&gt;)this.logJdbcTemplate.query(this.dbQuery, new Object[] {this.someKey}, new BeanPropertyRowMapper&lt;String&gt;(String.class));
</code></pre>

<p>Strangely, when I print the <code>size</code> of the rulesList after above statement, the <code>size</code> returned is 4, which are the number of <code>Strings</code> returned from database. However, the list has all blank elements when checking during debug.</p>

<p>What's the issue ?</p>