JdbcTemplate queryForList return value in case of no results

Reins picture Reins · Jul 17, 2014 · Viewed 13.9k times · Source

The question is pretty much summed up in the title. What will JdbcTemplate.queryForList() return when the query returns no results. Will it return an empty List or null value? I couldn't find a definitive answer from the documentation. Thanks in advance!

Answer

Stephane Nicoll picture Stephane Nicoll · Jul 17, 2014

The javadoc states that it will return

a List of objects that match the specified element type

If there's no element, the list is empty.