mericahero / mybatisnet

Automatically exported from code.google.com/p/mybatisnet
0 stars 0 forks source link

Nullable int 32 number type handler fails when procedure returns a null rather than a number #37

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Using trunk branch, but still occurs in other versions.

if NullableInt32TypeHandler.GetDataBaseValue gets called with a DBNull, it will 
fail because it tries to convert it to Int32 without testing for null.  Same 
happens with other nullable number types.  
I got this to happen with calling insert on datamapper when it is mapped to a 
procedure with returnclass as int? and the stored procedure or function returns 
null.

DataMapper.Insert("Diagnostics_WindowsEventCriteria", hash);

<procedure id="Diagnostics_WindowsEventCriteria" parameterClass="Hashtable" 
resultClass="int?" >
WINDOWSLOGSEARCHCRITERIA #Error# #ErrorSeverityId#
</procedure>

I would expect to get a null value back

Original issue reported on code.google.com by Marc...@gmail.com on 25 Jan 2012 at 7:01