ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: DefaultSqlSession.selectOne()
Date Wed, 14 Apr 2010 00:59:40 GMT
The definition of null is the absence of value and meaning.  So
regardless of whether it's a null column or no rows, no meaning should
be applied to it.  Thus these cases are the same.

If you want meaning to come from the row, return a value, perhaps the
row number.

Clinton

On 2010-04-13, cowwoc <cowwoc@bbs.darktech.org> wrote:
> Hi,
>
>      I hope I'm not reopening a hornet's nest but I just noticed the
> following comment in the code:
>
> // Popular vote was to return null on 0 results and throw exception on
> too many.
>
>      How do you differentiate between selectOne() returning null because
> it found no rows versus it finding a single row containing a null value?
> I remember Sun's Engineers had the same debate for auto-boxing (should a
> null Integer get unboxed as "0" or throw an exception?) and they settled
> on exceptions precisely because of this ambiguity. Was there a huge vote
> in favor of returning null for zero results or are you still open to
> some hand twisting? :)
>
> Gili
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

-- 
Sent from my mobile device

---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message