Sitemap

Member-only story

JdbcClient: The Fluent JDBC API That Retires Half Your RowMappers

4 min readSep 22, 2026

--

Press enter or click to view image in full size

If you are coming from Spring Data JPA, you are used to repositories that write your SQL for you. But sometimes you drop down to raw JDBC — a reporting query, a bulk read, a join that Hibernate insists on turning into ten queries. For years that meant JdbcTemplate or NamedParameterJdbcTemplate, and the constant small decision of which one to inject.

Since Spring Framework 6.1 (Spring Boot 3.2), there is a better default: JdbcClient. It is a fluent facade over both templates, and Spring Boot auto-configures a bean for you. In Spring Boot 4 it is the recommended entry point for JDBC. This post shows the parts you will actually use every day.

The problem with the old templates

Here is a typical NamedParameterJdbcTemplate read. It works, but notice how the SQL, the parameters, and the mapping are scattered across the call.

@Repository
@RequiredArgsConstructor
public class OrderJdbcRepository {

private final NamedParameterJdbcTemplate jdbc;

public List<Order> findByStatus(OrderStatus status) {

String sql = "SELECT id, customer_id, status, total_amount FROM orders WHERE status = :status";

MapSqlParameterSource params = new MapSqlParameterSource("status", status.name());

return jdbc.query(sql, params, (rs…

--

--

Cem Dırman
Cem Dırman

Written by Cem Dırman

Software Engineer @Atmosware || Java Lover || Traveller