[ http://issues.apache.org/jira/browse/IBATISNET-2?page=all ]

Gilles Bayon reassigned IBATISNET-2:
------------------------------------

    Assign To: Roberto Rabe  (was: Gilles Bayon)

> Inline null default causes exception for complex properties
> -----------------------------------------------------------
>
>          Key: IBATISNET-2
>          URL: http://issues.apache.org/jira/browse/IBATISNET-2
>      Project: iBatis for .NET
>         Type: Bug
>     Reporter: Gilles Bayon
>     Assignee: Roberto Rabe
>  Attachments: Account.xml.patch, IBatisNet.Test.Patches.zip
>
> Currently, NPetshop running on Access through OLEDB 
> gives an error when creating an Account.
> Fix is to change InsertProfile statement from:
> #Profile.IsShowFavorites#, #Profile.IsShowBanners#
> to:
> #Profile.IsShowFavorites:Boolean#, 
> #Profile.IsShowBanners:Boolean#
> Unfortunately, this won't work if a default null value is 
> given (exception about parameter not being found is 
> thrown):
> #Profile.IsShowFavorites:Boolean:false#, 
> #Profile.IsShowBanners:Boolean:false#
> This is caused by the comparison of the propertyName 
> Profile.IsShowFavorites to the Account property names 
> (hashtable that contains a property called Profile) when 
> a default null value is specified. This is being done in 
> ParameterMap.cs line 264 - 268.
> I'm also not sure why this doesn't work and causes the 
> generated SQL statement to show the inline parameters 
> instead of '?'s:
> <parameterMap id="AccountParam"> 
> <parameter property="Login" column="Account_Id"/> 
> <parameter property="Password" 
> column="SignOn_Password"/> 
> <parameter property="Email" column="Account_Email"/> 
> <parameter property="Status" 
> column="Account_Status" /> 
> <parameter property="Address.FirstName" 
> column="Account_FirstName"/> 
> <parameter property="Address.LastName" 
> column="Account_LastName"/> 
> <parameter property="Address.Address1" 
> column="Account_Addr1"/> 
> <parameter property="Address.Address2" 
> column="Account_Addr2"/> 
> <parameter property="Address.City" 
> column="Account_City"/> 
> <parameter property="Address.State" 
> column="Account_State"/> 
> <parameter property="Address.Zip" 
> column="Account_Zip"/> 
> <parameter property="Address.Country" 
> column="Account_Country"/> 
> <parameter property="Address.Phone" 
> column="Account_Phone"/> 
> <parameter property="Profile.FavoriteLanguage" 
> column="Profile_LangPref"/> 
> <parameter property="Profile.FavouriteCategory.Id" 
> column="Profile_FavCategory"/> 
> <parameter property="Profile.IsShowFavorites" 
> column="Profile_MyListOpt" dbType="Boolean"/> 
> <parameter property="Profile.IsShowBanners" 
> column="Profile_BannerOpt" dbType="Boolean"/> 
> </parameterMap> 
> 2004-10-20 23:27:37,115 [3120] DEBUG 
> IBatisNet.DataMapper.MappedStatements.MappedStatem
> ent [] - SQL for command: insert into Profiles 
> (Profile_LangPref, Profile_FavCategory, 
> Profile_MyListOpt, Profile_BannerOpt, Account_Id) 
> values (#Profile.FavoriteLanguage#, 
> #Profile.FavouriteCategory.Id#, 
> #Profile.IsShowFavorites#, #Profile.IsShowBanners#, 
> #Login#) 
> Even stranger was that when I specified the dbType for 
> FavoriteLanguage as String in addition to the existing 
> Boolean dbTypes already specified, the SqlMap wasn't 
> being built properly by DomSqlMapBuilder (it did work 
> again when I removed it).
> Looking through all this code has been great 
> though...hehe...
> Roberto 

-- 
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

Reply via email to