Monday 1 June 2009

Quick Tip for using SimpleJdbcTemplate

When using SimpleJdbcTemplte.queryForMap method, remember that the results returned as Map has keys in all capital letters. e.g

Map results = template.queryForMap("select id, balance from Account where id=?", account.getId());

In above case, to retrieve the value of id and balance use results.get("ID") and results.get("BALANCE") instead of results.get("id") and results.get("balance");

:)