Ok thanks …

 

I tried to use the hash table but I have a cross table query with unnamed columns. The real example is:

 

            <select id="somemap" parameterClass="parmnamespace, parmassembly">

                  SELECT

                  <iterate property="listprop" conjunction=",">sum(case mosTisID when #listprop[]# then mosImporto else 0 end)"</iterate>

                  FROM sometable

            </select>

 

So the hashtable can’t work.

 

Marco

 


From: Gilles Bayon [mailto:[EMAIL PROTECTED]
Sent: Friday, November 11, 2005 12:16 PM
To: [email protected]
Subject: Re: Error in using an ArrayList type as resultClass in IBatis for .net

 

Arraylist as resultClass is currently not supported
 

For your requirement, try to use

<select id="GetAllDocumentPlain"
      resultClass="Hashtable">
   select
  *
   from Documents
  </select>

 

see nunit test GetAllAccountsAsHashtableViaResultClass

IList list = sqlMap.QueryForList("GetAllAccountsAsHashtableViaResultClass", null);

each row will be store on a Hashtable

 

I will add your fix in SVN

 

On 11/11/05, Rencelj Marco <[EMAIL PROTECTED]> wrote:

Thanks Gilles,

  But what about this:

             <select id ="GetAllDocumentPlain" class ="ArrayList">

                  select

                        *

                  from Documents

                  order by Document_Type, Document_Id

            </select >

 

Or

             <select id ="GetAllDocumentPlain">

                  select

                        *

                  from Documents

                  order by Document_Type, Document_Id

            </select >

 

???

 

Where's my error?

 

thanks

 


From: Gilles Bayon [mailto: [EMAIL PROTECTED]]
Sent: Friday, November 11, 2005 9:30 AM
To: [email protected]
Subject: Re: Error in using an ArrayList type as resultClass in IBatis for .net

 

If you want to get an ArrayList, you don't need to specify the resultClass. The listClass attribut is used for typed collection.

 

Sample from unit test

<select id="GetAllDocument"
   resultMap="document">
   select
    *
   from Documents
   order by Document_Type, Document_Id
  </select>

 

IList list = sqlMap.QueryForList("GetAllDocument", null);
 

On 11/11/05, Rencelj Marco < [EMAIL PROTECTED]> wrote:

I had to get a list with a variable number of columns so I had to try ArrayList as resultClass (columns are unnamed).

The ArrayList is populated with a correct number of rows but each row instance is an empty ArrayList.

I fixed the problem in source code adding a code fragment in MappedStatement.cs as in included code.

Anybody had the same problem? May be there is a release that include this fix …

Thanks in advane

Marco

 

Reply via email to