ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Miika Mäkinen" <mmi...@gmail.com>
Subject Re: Multiple resultsets in data mapper
Date Fri, 25 May 2007 15:29:50 GMT
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 <Tom.Nguyen@rels.info> wrote:
> Some documentation here:
> http://ibatisnet.sourceforge.net/DevGuide.html#d0e997
>
>
>
> Regards,
>
>
> Tom Nguyen
> Sr. Developer
> tom.nguyen@rels.info <mailto:tom.nguyen@rels.info>
>
>
>
> ________________________________
>
> From: chook rib [mailto:chookrib@gmail.com]
> Sent: Friday, May 25, 2007 9:41 AM
> To: user-cs@ibatis.apache.org
> 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.
> ************************************************************************************
>

Mime
View raw message