nerdexam
Broadcom-VMware

2V0-72.22PSE · Question #84

Which two statements are true regarding result set handling? (Choose two.)

The correct answer is C. JdbcTemplate can return each row of a ResultSet as a Map. D. RowMapper interface is used for mapping a single row of a ResultSet to an object. C is correct because JdbcTemplate provides queryForList() and queryForMap() methods that represent each row as a Map<String, Object>, where column names are the keys - useful when you don't want to define a custom mapper. D is correct because RowMapper<T> is a functional…

Data Access

Question

Which two statements are true regarding result set handling? (Choose two.)

Options

  • AJdbcTemplate is configured with a default RowMapper.
  • BJdbcTemplate can return each row of a ResultSet as a Set.
  • CJdbcTemplate can return each row of a ResultSet as a Map.
  • DRowMapper interface is used for mapping a single row of a ResultSet to an object.
  • ERowMapper interface cannot be used for multiple row queries.

How the community answered

(24 responses)
  • A
    4% (1)
  • C
    88% (21)
  • E
    8% (2)

Explanation

C is correct because JdbcTemplate provides queryForList() and queryForMap() methods that represent each row as a Map<String, Object>, where column names are the keys - useful when you don't want to define a custom mapper.

D is correct because RowMapper<T> is a functional interface with a single method mapRow(ResultSet rs, int rowNum) that converts one row into a domain object. Spring calls this per-row, and it works with both single-row (queryForObject) and multi-row (query) methods, returning a List<T> in the latter case.

Why the distractors are wrong:

  • A: JdbcTemplate has no default RowMapper - you must always supply one explicitly or use a built-in alternative like BeanPropertyRowMapper.
  • B: Rows are returned as Map, never Set - a Set has no column-to-value semantics.
  • E: This is the opposite of the truth; RowMapper is heavily used for multi-row queries via jdbcTemplate.query(sql, rowMapper), which returns a List<T>.

Memory tip: Think "Columns → Collection (Map)" for option C, and "Domain object per row → DRowMapper" for option D. The key trap is E - don't confuse RowMapper (maps one row, used for many) with ResultSetExtractor (processes the entire ResultSet at once).

Topics

#JdbcTemplate#RowMapper#ResultSet mapping#Data Access APIs

Community Discussion

No community discussion yet for this question.

Full 2V0-72.22PSE Practice