-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: order by with a composite
PostPosted: Mon Nov 15, 2010 1:59 pm 
Newbie

Joined: Tue Jan 05, 2010 2:33 pm
Posts: 15
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


Top
 Profile  
 
 Post subject: Re: order by with a composite
PostPosted: Mon Nov 15, 2010 2:08 pm 
Newbie

Joined: Tue Jan 05, 2010 2:33 pm
Posts: 15
any ideas ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.