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!
JdbcTemplate queryForList return value in case of no results
Asked Answered
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.
I was not sure if I could make that assumption. Seems I could. Thanks alot! –
Selfhypnosis
It will return an empty list. So you can test it with list.isEmpty()
. It will return true in this case.
© 2022 - 2024 — McMap. All rights reserved.