You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Clinton Begin <cl...@gmail.com> on 2009/08/29 17:21:38 UTC

iBATIS 3 selectOne() -- no more exception on ZERO results

Just a quick warning for those who are already working with iBATIS 3...

selectOne() used to throw an exception when no results were returned (by
design), but through popular vote of the community, we've decided that the
new behavior should be:

- If ZERO results were found, return null
- If MULTIPLE results were found, throw a TooManyResultsException
- If ONE result was found, return it.

The reason this warning is necessary is that if you were using the exception
for flow control (try/catch), you'll need to change it to a conditional (if
not null/else).

http://issues.apache.org/jira/browse/IBATIS-630

Cheers,
Clinton