[ http://issues.apache.org/jira/browse/IBATISNET-139?page=all ]
Ron Grabowski closed IBATISNET-139:
-----------------------------------
Resolution: Fixed
Fixed in 378979.
> DBNull.Value as parameter object raises NullReferenceException in
> UnknownTypeHandler
> ------------------------------------------------------------------------------------
>
> Key: IBATISNET-139
> URL: http://issues.apache.org/jira/browse/IBATISNET-139
> Project: iBatis for .NET
> Type: Bug
> Reporter: Ron Grabowski
> Assignee: Ron Grabowski
> Priority: Minor
>
> This code from UnknownTypeHandler.cs:
> ITypeHandler handler = _factory.GetTypeHandler( parameterValue.GetType(),
> dbType );
> raises a NullReferenceException if the parameterValue is DBNull.Value. Here's
> an example:
> // raises NullReferenceException
> Hashtable map = new Hashtable();
> map["DBNullValue"] = DBNull.Value;
> sqlMapper.QueryForObject("User.Search", map);
> <update id="UpdateNullEmailToDBNull" parameterClass="Hashtable">
> UPDATE Accounts SET Account_Email = #DBNullValue# WHERE Account_Email IS
> NULL
> </update>
> There needs to be a DBNullTypeHandler class deals with DBNull.Value instead
> of using the UnknownTypeHandler.
> One of my co-workers called:
> // returns IList of IDictionary objects
> IList list = sqlMapper.QueryForList("User.Search", hashtable);
> Using QuickWatch, I saw that one of the values in the IDictionary objects
> contained DBNull instead of null. How is DBNull being returned? I wasn't able
> to reproduce this behavior on my machine. He was running his query against a
> SQL Server 2000 database under .NET 1.1.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira