ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kai Grabfelder <nos...@kinokai.de>
Subject Re: Sort resultset from multiple requests
Date Tue, 23 Sep 2008 18:37:18 GMT
Hi Helio,

what does your getCatName select looks like? Can't you just use an order by in that select?
Furthermore, you
may want to have a look at the groupBy feature of iBATIS to avoid the n+1 select problem.
 The documentation
[1] describes this in more detail.

Regards

Kai

[1] http://svn.apache.org/repos/asf/ibatis/trunk/java/ibatis-2/ibatis-2-docs/en/



--- Original Nachricht ---
Absender: Heliodromel
Datum: 23.09.2008 15:19
> Hi everybody,
> 
> i've got a question about sorting. It's maybe stupid but i can't find the
> solution.
> 
> Here is my problem :
> 
> I make a simple request in a database, for example :
> 
> <select id="MyRequest" parameterClass="map" resultMap="MyRequest.result">
>     select firstname, lastname, age, ref_cat from MyTable
> </select>
> 
> And i got a simple resultmap, something like that :
> 
> <resultMap id="MyRequest.result">
>     <result property="firstname" column="firstname" columnIndex="1"/>
>     <result property="lastname" column="lastname" columnIndex="2"/>
>     <result property="age" column="age" columnIndex="3"/>
>     <result property="cat" column="ref_cat" columnIndex="4"
> select="getCatName"/>
> </resultMap>
> 
> And we consider that the request getCatName returns a resultset containing
> the name and the age of the persons cat(s).
> 
> I would like to sort the persons results represented by this resutmap by the
> name of the cat(s).  
> 
> Is it possible ?
> 
> Thank's for your help,
> 
> Helio.


Mime
View raw message