Get a list of Object from jdbcTemplate()

Sometime happens get a list of object from database and, to do that without call a RowMapper, use this:

List<Object> strings = (List<Object>) jdbcTemplate.queryForList(query, Object.class);

This is a sample to get a list of String:

List<String> strings = (List<String>) jdbcTemplate.queryForList(query, String.class);
Tagged

Leave a Reply