Without spending a lot of time thinking about it, the thing to do is probably 
execute two iBatis calls and then combine the results in the app like you do 
already.  If it's possible, you could use some sorting and you could build your 
data structure faster than loading up a dictionary just for matching.  Your 
fastest way to load is probably to join the data and then parse the results 
right from the reader and build the objects as the company data changes as the 
joined rows are processed.  Of course, that's would be using direct data 
readers, so it probably wouldn't be too elegant with iBatis.

I understand the desire to be very efficient via multiple result sets as I've 
done that myself before, but if you're loading enough data in these two queries 
that performance is significant than iBatis making two network calls to the 
database is an overhead that I frankly don't think you could even quantify over 
a multiple result set scenario.  Regardless, someone else will have to answer 
if iBatis handles multiple result sets or not, I've never needed them w/iBatis.


-----Original Message-----
From: Miika Mäkinen [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 25, 2007 11:30 AM
To: [email protected]
Subject: Re: Multiple resultsets in data mapper

Thanks guys, maybe i wasn't clear enough. What i'd like to have is sql
returning two tables. In table one up to hundreds of companies and in
the second table the classifications for each (M:M). I've done it
before so that i load the companies into a dictionary with id as a key
and then add the classifications to each item in the dictionary. If
i've understood correctly, this is not possible with ibatis? Lazy
loading won't help me as i need to display everything at once, and the
join method would lead to whole lot of data loading as there will be
several similar collections within company. This is quite a central
piece me the app, so i'd like to get it perform well.

On 5/25/07, Nguyen, Tom <[EMAIL PROTECTED]> wrote:
> Some documentation here:
> http://ibatisnet.sourceforge.net/DevGuide.html#d0e997
>
>
>
> Regards,
>
>
> Tom Nguyen
> Sr. Developer
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>
>
>
> ________________________________
>
> From: chook rib [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 25, 2007 9:41 AM
> To: [email protected]
> Subject: Re: Multiple resultsets in data mapper
>
>
>
> sorry, have a slip, this is right
>
>       <resultMaps>
>         <resultMap id="CompanyResult" class="Company">
>          <result property="Id" column="CompanyId" />
>          <result property="Name" column="CompanyName" />
>          <result property="Classifications" column="CompanyId"
> select="SelectClassifications" lazyLoad="true" />
>         </resultMap>
>         <resultMap id="ClassificationResult" class="Classification">
>          <result property="Id" column="ClassificationId" />
>          <result property="Name" column="ClassificationName" />
>         </resultMap>
>        </resultMaps>
>
>        <statements>
>         <select id="SelectCompanies" resultMap="CompanyResult">
>          SELECT CompanyId, CompanyName FROM Company
>         </select>
>
>         <select id="SelectClassifications" parameterClass="int"
> resultMap="ClassificationResult">
>          SELECT CompanyId, ClassificationId, ClassificationName FROM
> CompanyClassification INNER JOIN Classification ON
> CompanyClassification.ClassificationId=Classification.ClassificationId;
>         </select>
>       </statements>
>       
>
>
> ************************************************************************************
> This e-mail message and any files transmitted herewith, are intended solely
> for the
> use of the individual(s) addressed and may contain confidential, proprietary
> or
> privileged information.  If you are not the addressee indicated in this
> message
> (or responsible for delivery of this message to such person) you may not
> review,
> use, disclose or distribute this message or any files transmitted herewith.
> If you
> receive this message in error, please contact the sender by reply e-mail and
> delete
> this message and all copies of it from your system.
> ************************************************************************************
> 
--------------------------------------------------------

Princeton Retirement Group, Inc - Important Terms 
This E-mail is not intended for distribution to, or use by, any person or 
entity in any location where such distribution or use would be contrary to law 
or regulation, or which would subject Princeton Retirement Group, Inc. or any 
affiliate to any registration requirement within such location. 
This E-mail may contain privileged or confidential information or may otherwise 
be protected by work product immunity or other legal rules. No confidentiality 
or privilege is waived or lost by any mistransmission. Access, copying or 
re-use of information by non-intended or non-authorized recipients is 
prohibited. If you are not an intended recipient of this E-mail, please notify 
the sender, delete it and do not read, act upon, print, disclose, copy, retain 
or redistribute any portion of this E-mail. 
The transmission and content of this E-mail cannot be guaranteed to be secure 
or error-free. Therefore, we cannot represent that the information in this 
E-mail is complete, accurate, uncorrupted, timely or free of viruses, and 
Princeton Retirement Group, Inc. cannot accept any liability for E-mails that 
have been altered in the course of delivery. Princeton Retirement Group, Inc. 
reserves the right to monitor, review and retain all electronic communications, 
including E-mail, traveling through its networks and systems (subject to and in 
accordance with local laws). If any of your details are incorrect or if you no 
longer wish to receive mailings such as this by E-mail please contact the 
sender by reply E-mail. 

--------------------------------------------------------

Reply via email to