I have an employee table. In the employee table I have a contact details id which maps to another table. THis other table contains the employee first and last name.
I have employee objects which contain a Set of employee children. So one emnployee can have a team.
This works very well, however when get the children the order that they appear in my app is always random. So I think oh great I can just add the order by element to my mapping xml :
Code:
<set name="children" inverse="false" lazy="false" order-by="" cascade="save-update">
<key column="INT_REPORTS_TO"/>
<one-to-many class="com.populus.dao.bean.EmployeeLightWeight"/>
</set>
My problem is that The attribute that I want to order the children is actually in the contact details table and not in the employee table. So I need to something like this :
order-by="CONTACT_DETAILS.TXT_LAST_NAME asc"
Any ideas how I can sort by the sub attribute?
Thanks in advance,
Spunog