I’m using spring’s JdbcDaoSupport for making data base call. I want to execure native query (sql query) for retrieving data. Do we have any API available in JdbcTemplate for native query? I used queryForObject but it throws exception if there is no data whereas i was expecting it to return back null if it couldn’t find data.
I’m using spring’s JdbcDaoSupport for making data base call. I want to execure native
Share
There are many options available for executing native sql with
JdbcTemplate. The linked documentation contains plenty of methods that take native sql, and usually some sort of callback handler, which will accomplish exactly what you are looking for. A simple one that comes to mind isquery(String sql, RowCallbackHandler callback).