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\)" <[EMAIL PROTECTED]>

21/08/2006 16:01

Please respond to
[email protected]

To
<[email protected]>
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>

 




Reply via email to