开发者

What does SimpleJDBCTemplate.queryForInt do when the database returns null?

开发者 https://www.devze.com 2023-01-04 10:52 出处:网络
What does SimpleJDBCTemplate.queryForInt do when the SQL query\'s actual result is null开发者_StackOverflow?

What does SimpleJDBCTemplate.queryForInt do when the SQL query's actual result is null开发者_StackOverflow?

In particular, what happens if I run queryForInt("select max(foo) from f") and f has no rows?

While I'm on this subject, what happens if I run queryForInt("select foo from f") and f has no rows?


If the query returns null, the queryForInt method will return 0. However, if the query returns no rows, or returns more than one row, queryForInt will throw an IncorrectResultSizeDataAccessException.

Source

0

精彩评论

暂无评论...
验证码 换一张
取 消