You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Roberto Rabe (JIRA)" <ib...@incubator.apache.org> on 2005/01/14 20:00:17 UTC
[jira] Commented: (IBATISNET-20) Type problems when applying parameters
[ http://issues.apache.org/jira/browse/IBATISNET-20?page=comments#action_57638 ]
Roberto Rabe commented on IBATISNET-20:
---------------------------------------
Hi. What database and provider are you using?
I ran this test using a Guid parameterClass with the SqlClient provider (SQL Server 2000), and it worked/passed:
<statement id="InsertCategoryGuidParameterClass" parameterClass="Guid" resultClass="int">
insert into Categories
(Category_Name, Category_Guid)
values
('toto', #value:UniqueIdentifier#);
select CAST(SCOPE_IDENTITY() as int) as value
</statement>
Roberto
> 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