I used JdbcTemplate in SpringBoot, and there was a case where I wanted to get the results in reverse order, so I recorded it as a memorandum. I think there is a clue that you should get it by order by, but in rare cases where you cannot simply sort by order by (for example, when you express a hierarchical structure using recursive). Encounter.
SqlRowSet rs = jdbcTemplate.queryForRowSet(sql, param);
rs.afterLast();
while(rs.previous()) {
//You can take the opposite here
//For example rs.getString("name");
}
Recommended Posts