nerdexam
Broadcom-VMware

2V0-72.22PSE · Question #27

Which two statements describe Spring JdbcTemplate? (Choose two.)

The correct answer is B. The JdbcTemplate provides the ability to work with result sets. D. The JdbcTemplate provides methods for query execution. JdbcTemplate is a Spring abstraction that executes SQL you provide and maps the results - making B and D correct. It gives you methods like query(), queryForObject(), and update() (D), and it handles ResultSet processing through callbacks like RowMapper (B). Why the distractors…

Data Access

Question

Which two statements describe Spring JdbcTemplate? (Choose two.)

Options

  • AAll JdbcTemplate methods throw SQLException which you are required to handle.
  • BThe JdbcTemplate provides the ability to work with result sets.
  • CThe JdbcTemplate can only perform update but not insert to the database.
  • DThe JdbcTemplate provides methods for query execution.
  • EThe JdbcTemplate generates SQL statements.

How the community answered

(47 responses)
  • A
    4% (2)
  • B
    91% (43)
  • C
    2% (1)
  • E
    2% (1)

Explanation

JdbcTemplate is a Spring abstraction that executes SQL you provide and maps the results - making B and D correct. It gives you methods like query(), queryForObject(), and update() (D), and it handles ResultSet processing through callbacks like RowMapper (B).

Why the distractors are wrong:

  • A - JdbcTemplate translates SQLException into Spring's unchecked DataAccessException hierarchy, so you are not required to handle it.
  • C - JdbcTemplate.update() handles INSERT, UPDATE, and DELETE - not just updates.
  • E - JdbcTemplate executes the SQL you write; it never generates SQL. That's the role of higher-level abstractions like JPA/Hibernate or Spring Data.

Memory tip: Think of JdbcTemplate as a smart executor - you supply the SQL, it runs it and gives you the results back. If it generated SQL or forced checked exceptions, you'd be thinking of a different tool (ORM) or a lower-level one (raw JDBC).

Topics

#JdbcTemplate#Query Execution#Result Set Handling#Exception Translation

Community Discussion

No community discussion yet for this question.

Full 2V0-72.22PSE Practice