ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stief Dirckx <Stief.Dir...@icasa-consulting.com>
Subject RE: dynamic order by clause
Date Wed, 23 Aug 2006 11:12:56 GMT
Hmmm, I feel like a real rookie now.

1. You're talking about a parameterClass not a parameterMap? Is this map 
an hashtable or something then?

2. So If I want to sort on multiple fields I have to make a sortcriteria 
class with 2 properties (sortfield and sorttype) and than make an ilist 
with multiple sort expressions? How does this work with the first step?

Hope you can give some more information.





"Gentile, Wayne \(Hitachi Consulting\)" <wayne.gentile-eds@eds.com> 
21/08/2006 16:01
Please respond to
user-cs@ibatis.apache.org


To
<user-cs@ibatis.apache.org>
cc

Subject
RE: dynamic order by clause






You have a couple of options.
 
1.      Pass a map as the parameterClass and add your User object, 
SortField, and SortType to the map before calling the statement. The key 
names of the map will match the names in the map.
2.      Create a SortCriterion class with a SortField and SortType 
property and pass multiple instances using a map (if you want to sort by 
multiple fields).
 
The map then looks like this:
 
<select id="SelectUser" parameterClass="map" resultMap="UserResult"> 
    ... 
    <dynamic prepend="ORDER BY "> 
        <isNotEmpty property="SortField"> 
            ORDER BY $SortField$ $SortType$ 
        </isNotEmpty> 
    </dynamic> 
</select>
 



Mime
View raw message