pksiv wrote:
Version4 wrote:
pksiv wrote:
Criteria.addOrder(...) merely adds an ORDER BY statement to the SQL retrieving the data from the database. For what you're talking about, I think you would need to create a Sorted Collection object and implement a custom Comparator to sort them.
Thank you, but I am not quite sure how to implement a sorted collection using Hibernate. Are you refering to the 'sort' property of a mapping and passing it a comparator? If so, is the comparator the same as a standard comparator in Java?
The <set>, <map> etc... have a sort="" attribute which allows you to specify a custom Java Comparator class. See Section 7.3.1 in the reference docs.
Thanks again, I looked into using a map or set but I don't think I can do this since I am gathering all my data directly from a View. My mapping file looks simliar to the following.
<class name="srViewDb" table="VIEW_SR">
<id name="id" type="java.lang.Long" column="id">
<generator class="assigned" />
</id>
<property name="IMId" column="IMID" type="java.lang.Long"/>
<property name="IMName" sort="" column="IMNAME" type="java.lang.String"/>
<property name="IMAccountNum" column="IMACCOUNTNUM" type="java.lang.String"/>
.......
</class>
The IMAccountNum is having the issue. Any other suggestions would be very helpful or a correction to the above mapping.