liveBook · Manning

RowMapper

As explained in Spring in Action, Sixth Edition

RowMapper is a Spring JDBC interface that maps one row of a query result to an object.

RowMapper is a Spring JDBC interface that converts one ResultSet row into an application object. JdbcTemplate.query() uses it while reading database results. section 3.1.2

Mapping ingredients

An ingredient repository queries id, name, and type columns, then maps each row to an Ingredient. The mapper reads strings from ResultSet and converts type with Ingredient.Type.valueOf().

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains query integration and explicit implementation, but stops short of RowMapper interface internals.
Examples
Demonstrates mapping Ingredient rows with a method reference and an inline RowMapper passed to queryForObject().
What it assumes
Assumes basic Java and SQL knowledge while demonstrating ResultSet access and row-to-object conversion.
What you can do after
Apply it via JdbcTemplate to convert query results into domain objects.
How it connects
Connects RowMapper with JdbcTemplate, ResultSet, SQL queries, repositories, and Java method references.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.