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 cowwoc <co...@bbs.darktech.org> on 2010/04/14 02:05:20 UTC

DefaultSqlSession.selectOne()

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


Re: DefaultSqlSession.selectOne()

Posted by Jeff Butler <je...@gmail.com>.
http://opensource.atlassian.com/confluence/oss/display/IBATIS/Contribute+Documentation

Jeff Butler

On Wed, Apr 14, 2010 at 10:15 AM, cowwoc <co...@bbs.darktech.org> wrote:
>
>    I don't mind using the workaround you outlined so long as it's mentioned
> in the iBatis 3 documentation. Right now it doesn't mention anything about
> the behavior of selectOne() or @Select returning a single value.
>
> Gili
>
> On 13/04/2010 8:59 PM, Clinton Begin wrote:
>>
>> 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<co...@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
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

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


Re: DefaultSqlSession.selectOne()

Posted by cowwoc <co...@bbs.darktech.org>.
     I don't mind using the workaround you outlined so long as it's 
mentioned in the iBatis 3 documentation. Right now it doesn't mention 
anything about the behavior of selectOne() or @Select returning a single 
value.

Gili

On 13/04/2010 8:59 PM, Clinton Begin wrote:
> 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<co...@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
>>
>>
>>      
>    


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


Re: DefaultSqlSession.selectOne()

Posted by Clinton Begin <cl...@gmail.com>.
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 <co...@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