liveBook · Manning

RowMapper

RowMapper is a Spring JDBC interface for converting a row of a result set into an application object.

How 3 Manning books explain it

Spring Start Here, Second Edition

A RowMapper is a Spring JDBC callback interface that converts one row of a result set into an application object.

How it is used
Maps rows returned by a SELECT query into application objects for retrieval through JdbcTemplate.
How deep it goes
Works through a lambda that creates a Purchase and assigns its id, product, and price from each result-set row.
Examples
Maps purchase table rows into Purchase objects using id, product, and price columns.
What you can do after
Apply it via JdbcTemplate by mapping each result-set row into a model object.

Read how Spring Start Here, Second Edition explains RowMapper →

Test Driven: Practical TDD and Acceptance TDD for Java Developers

RowMapper is a Spring interface for converting a row of database results into an object.

How it is used
Converts database result rows into objects passed back by a Spring JdbcTemplate query.
How deep it goes
Defines mapRow with a ResultSet and row number, then demonstrates mapping two columns into Person.
Examples
Maps first_name and last_name columns into a Person with PersonRowMapper.
What you can do after
Build it from scratch: implement a mapper that reads ResultSet columns and constructs a Person.

Read how Test Driven: Practical TDD and Acceptance TDD for Java Developers explains RowMapper →

Spring in Action, Sixth Edition

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

How it is used
Maps database query rows into domain objects while repositories read data through JdbcTemplate.
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 you can do after
Apply it via JdbcTemplate to convert query results into domain objects.

Read how Spring in Action, Sixth Edition explains RowMapper →

What to know first

Related concepts

Questions about RowMapper

What is RowMapper?

RowMapper is a Spring JDBC interface for converting a row of a result set into an application object.

Which Manning books explain RowMapper?

Spring Start Here, Second Edition, Test Driven: Practical TDD and Acceptance TDD for Java Developers and Spring in Action, Sixth Edition.

What should I know before learning RowMapper?

Manning books that teach RowMapper usually introduce JDBC and SQL first.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.