|
View:
New views
8 Messages
—
Rating Filter:
Alert me
|
|
|
Multiple ResultMap SupportI'm trying to use the multiple resultset support in one of my maps. I only receive one list of objects back. I expected a list of lists back. Is the following supported somehow? If not I suppose I could loop through and split the list by type myself. Thanks Mike <select id="GetMultipleResultMap" resultMap="account, category"> select * from accounts select * from categories </select> IList list = sqlMap.QueryForList("GetMultipleResultMap", null); IList<Account> accountList = list[0]; |
|
|
|
|
|
Re: Multiple ResultMap SupportSorry, I should have been more specific. I think my sql is fine. I'm getting two resultsets back from sql server, but only one from queryForList. The list that comes back has both accounts and categories objects in it rather than a list with two elements ( a list of accounts and a list of categories). Looking at the code, a single arraylist is created outside the loop of resultsets and then all the objects from both sql resultsets are added to the same list. Mike On 6/12/08, Ron Grabowski <rongrabowski@...> wrote:
|
|
|
RE: Multiple ResultMap SupportIs there anyone who can help me out? when i run the
ibatis tutorial sample. system throw out this
exception.
thx
Description: An unhandled exception occurred during the execution of the current
web request. Please review the stack trace for more information about the error
and where it originated in the code.
Exception Details: IBatisNet.Common.Exceptions.ConfigurationException: Invalid SqlMap.config document. cause :The attribute targetNamespace does not match the designated namespace URI. An error occurred at file:///C:/WINNT/system32/SqlMapConfig.xsd, (2, 2). The 'sqlMapConfig' element is not declared. An error occurred at , (1, 2). The 'properties' element is not declared. An error occurred at , (3, 6). Could not find schema information for the attribute 'resource'. An error occurred at , (3, 17). The 'settings' element is not declared. An error occurred at , (5, 3). The 'setting' element is not declared. An error occurred at , (5, 13). Could not find schema information for the attribute 'useStatementNamespaces'. An error occurred at , (5, 21). The 'setting' element is not declared. An error occurred at , (5, 55). Could not find schema information for the attribute 'cacheModelsEnabled'. An error occurred at , (5, 63). The 'database' element is not declared. An error occurred at , (5, 103). The 'provider' element is not declared. An error occurred at , (5, 113). Could not find schema information for the attribute 'name'. An error occurred at , (5, 122). The 'dataSource' element is not declared. An error occurred at , (5, 144). Could not find schema information for the attribute 'name'. An error occurred at , (5, 155). Could not find schema information for the attribute 'connectionString'. An error occurred at , (5, 177). The 'sqlMaps' element is not declared. An error occurred at , (5, 230). The 'sqlMap' element is not declared. An error occurred at , (5, 239). Could not find schema information for the attribute 'resource'. An error occurred at , (5, 246). |
|
|
This SQL map does not contain an ResultMap named Address ResultHi All,
I am just starting the IBatis.net by
tailoring the tutorial sample. encountering one problem, program shows
that:
This SQL map does not contain an ResultMap
named Address Result
<?xml version="1.0" encoding="UTF-8" ?> <sqlMap namespace="SIFM.Domain" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <alias> <typeAlias alias="Account" type="SIFM.Domain.Account ,SIFM"/> <typeAlias alias="Address" type="SIFM.Domain.Address ,SIFM" /> <typeAlias alias="Profile" type="SIFM.Domain.Profile ,SIFM" /> </alias> <resultMaps> <resultMap id="AddressResult" class="Address"> <result property="FirstName" column="Account_FirstName"/> <result property="LastName" column="Account_LastName"/> <result property="Address1" column="Account_Addr1"/> <result property="Address2" column="Account_Addr2"/> <result property="City" column="Account_City"/> <result property="State" column="Account_State"/> <result property="Zip" column="Account_Zip"/> <result property="Country" column="Account_Country"/> <result property="Phone" column="Account_Phone"/> </resultMap> <resultMap id="ProfileResult" class="Profile"> <result property="FavoriteLanguage" column="Profile_LangPref"/> <result property="FavouriteCategory" column="Profile_FavCategory" select="GetCategory"/> <result property="IsShowFavorites" column="Profile_MyListOpt"/> <result property="IsShowBanners" column="Profile_BannerOpt"/> </resultMap> <resultMap id="AccountResult" class="Account"> <result property="Login" column="Account_Id"/> <result property="Password" column="SignOn_Password"/> <result property="Email" column="Account_Email"/> <result property="Status" column="Account_Status" /> <result property="Address" resultMapping="AddressResult" /> <result property="Profile" resultMapping="ProfileResult" /> </resultMap> </resultMaps> <!-- ============================================= MAPPED STATEMENTS ============================================= --> <statements> <insert id="InsertAccount" parameterClass="Account"> insert into Accounts ( Account_Email, Account_FirstName, Account_LastName, Account_Status, Account_Addr1, Account_Addr2, Account_City, Account_State, Account_Zip, Account_Country, Account_Phone, Account_Id) values ( #Email#, #Address.FirstName#, #Address.LastName#, #Status#, #Address.Address1#, #Address.Address2#, #Address.City#, #Address.State#, #Address.Zip#, #Address.Country#, #Address.Phone#, #Login#) </insert> <update id="UpdateAccount" parameterClass="Account"> update Accounts set Account_Email = #Email#, Account_FirstName = #Address.FirstName#, Account_LastName = #Address.LastName#, Account_Status = #Status#, Account_Addr1 = #Address.Address1#, Account_Addr2 = #Address.Address2#, Account_City = #Address.City#, Account_State = #Address.State#, Account_Zip = #Address.Zip#, Account_Country = #Address.Country#, Account_Phone = #Address.Phone# where Account_Id = #Login# </update> <insert id="InsertProfile" parameterClass="Account"> insert into Profiles (Profile_LangPref, Profile_FavCategory, Profile_MyListOpt, Profile_BannerOpt, Account_Id) values (#Profile.FavoriteLanguage#, #Profile.FavouriteCategory.Id#, #Profile.IsShowFavorites#, #Profile.IsShowBanners#, #Login#) </insert> <update id="UpdateProfile" parameterClass="Account"> update Profiles set Profile_LangPref = #Profile.FavoriteLanguage#, Profile_FavCategory = #Profile.FavouriteCategory.Id#, Profile_MyListOpt = #Profile.IsShowFavorites#, Profile_BannerOpt = #Profile.IsShowBanners# where Account_Id = #Login# </update> <insert id="InsertSignon" parameterClass="Account"> insert into SignsOn (SignOn_Password, Account_Id) values (#Password#, #Login#) </insert> <update id="UpdateSignon" parameterClass="Account"> update SignsOn set SignOn_Password = #Password# where Account_Id = #Login# </update> <select id="GetAccountByLoginAndPassword" resultMap="AccountResult" parameterClass="Account"> select S.Account_Id, SignOn_Password, Account_Email, Account_FirstName, Account_LastName, Account_Status, Account_Addr1, Account_Addr2, Account_City, Account_State, Account_Zip, Account_Country, Account_Phone, Profile_LangPref, Profile_FavCategory, Profile_MyListOpt, Profile_BannerOpt from Accounts as A, SignsOn as S, Profiles as P where A.Account_Id = #Login# and SignOn_Password = #Password# and S.Account_Id = A.Account_Id and P.Account_Id = A.Account_Id </select> </statements> </sqlMap> |
|
|
RE: This SQL map does not contain an ResultMap named Address ResultFix by change
<sqlMap
namespace="SIFM.Domain" to
<sqlMap
namespace="" Eric From: Eric Ye (GJJ7YYE) Sent: Friday, June 13, 2008 4:24 PM To: user-cs@... Subject: This SQL map does not contain an ResultMap named Address Result Hi All,
I am just starting the IBatis.net by
tailoring the tutorial sample. encountering one problem, program shows
that:
This SQL map does not contain
an ResultMap named Address Result
|
|
|
Re: This SQL map does not contain an ResultMap named Address ResultYou might want to look at the useStatementNamespaces setting in your sqlmap.config. http://ibatis.apache.org/docs/dotnet/datamapper/ch04s03.html#id378950 On 6/13/08, yeric@... <yeric@...> wrote:
|
|
|
Re: Multiple ResultMap SupportI dug into the code and found my issue. IBatisNet.DataMapper\MappedStatements\MappedStatement.cs internal IList RunQueryForList(RequestScope request, ISqlMapSession session, object parameterObject, IList resultObject, RowDelegate rowDelegate) A single IList is created and appended to, no matter how many resultsets are returned from the IDataReader. I attached a patch with 10 minutes worth of code that "works" for my scenerio as an example. It is not backwards compatible as it creates a list for each resultset. We would probably need a way to opt in to a list of lists. A quick idea could be the following. Does the Java version have/want anything like this? We should match their map syntax if they do... <select id="GetMultipleResultMap" resultMap="account[], address, category[]"> select * from addresses where addressId = 23 select * from categories Also when creating empty list, why not create a generic list if we have the information to do so? I did that in the patch as well. Thoughts? Mike On 6/12/08, Michael Schall <mike.schall@...> wrote:
|
| Free Forum Powered by Nabble | Forum Help |