nerdexam
Broadcom-VMware

2V0-72.22PSE · Question #4

Which three types of objects can be returned form a JdbcTemplate query? (Choose three.)

The correct answer is A. Generic MapS B. Simple types (int, long, String, etc) D. User defined types. Spring's JdbcTemplate supports three result mapping strategies that align with real-world query needs: Generic Maps (A) allow any query result to be returned as Map<String, Object> without a predefined class; simple types (B) are returned via queryForObject() when a single…

Data Access

Question

Which three types of objects can be returned form a JdbcTemplate query? (Choose three.)

Options

  • AGeneric MapS
  • BSimple types (int, long, String, etc)
  • CJSONObject
  • DUser defined types
  • EProperties
  • FXMLObject

How the community answered

(37 responses)
  • A
    92% (34)
  • E
    3% (1)
  • F
    5% (2)

Explanation

Spring's JdbcTemplate supports three result mapping strategies that align with real-world query needs: Generic Maps (A) allow any query result to be returned as Map<String, Object> without a predefined class; simple types (B) are returned via queryForObject() when a single scalar value like a count or name is expected; and user-defined types (D) are returned via a RowMapper<T> implementation that maps each row to a custom domain object (e.g., Customer, Order).

Why the distractors are wrong:

  • C (JSONObject) - JdbcTemplate has no built-in awareness of JSON; JSON conversion is a separate concern handled outside the query layer.
  • E (Properties) - java.util.Properties is not a supported return type from JdbcTemplate queries.
  • F (XMLObject) - Similarly, XML mapping is not part of JdbcTemplate's API; it belongs to different frameworks like JAXB.

Memory tip: Think "Maps, Scalars, POJOs" - those three cover the spectrum from untyped to typed results, which is exactly what JdbcTemplate supports. If a type requires a special serialization format (JSON, XML), it's not handled at the JDBC layer.

Topics

#JdbcTemplate#Query Results#Data Access#Spring JDBC

Community Discussion

No community discussion yet for this question.

Full 2V0-72.22PSE Practice