Type problems when applying parameters
--------------------------------------
Key: IBATISNET-20
URL: http://issues.apache.org/jira/browse/IBATISNET-20
Project: iBatis for .NET
Type: Bug
Versions: DataMapper 1.1
Reporter: Henrik Uffe Jensen
I don't know if this error applies for both parameterMaps and with inline
parameterMaps. I only used inline parameterMaps.
When using parameterClass="Guid" in my Guid, I got an error saying "Object
must Implement IConvertible"
After a lot of debugging I found that no matter, what then the sql statemants
executed against the database used nvarchar(4000) an no other type.
I found that this is due to the changes made in
IBatisNet.DataMapper.MappedStatements.ApplyParameterMap from version 1.0.1 to
1.1
In 1.0.1 'sqlParameter.Value' is set at the top of the method. Setting 'Value'
on sqlParameter changes the sqlParameter.DbType from String (default) to the
correct type of the object value being set.
In 1.1 however you use 'parameterValue =' (line 265) instead, and
'sqlParameter.Value' is therefore never set, which means that the
'sqlParmenter.DbType' never changes from the default DbType. Further down the
method 'parameterCopy.DbType = sqlParameter.DbType;' (line 316 or 321) sets the
DbType of the parameterCopy, however this is always String.
I corrected the error by adding a 'sqlParameter.Value = parameterValue;' below
the 'parameterCopy.Value = parameterValue;' (line 301)
--
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
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira