-->
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.  [ 5 posts ] 
Author Message
 Post subject: ordering sets...
PostPosted: Thu Jan 22, 2004 5:00 am 
Beginner
Beginner

Joined: Thu Oct 02, 2003 5:06 am
Posts: 26
Location: Budapest, Hungary
this is probably a trivial question, but I'm trying to get a set from a parent-children connection, (parent.getChildren() )but I can't see how to define the ordering of the child set.

for instance, the child mapping has an int (childID), a string (childCode), and a date (childRegDate). I would like to be able to get these as sorted lists on the different fields, depending on where/why I need them. Is tehre any way to do this, or do I always have to sort them by hand afterwards?

Cheers
Ati.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 5:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Use a HQL order by clause to query them, or define them es a bag and use the order by / sort attributes in the mapping.


Top
 Profile  
 
 Post subject: thnx..
PostPosted: Thu Jan 22, 2004 5:04 am 
Beginner
Beginner

Joined: Thu Oct 02, 2003 5:06 am
Posts: 26
Location: Budapest, Hungary
ok.. so I wasn't nuts that I couldnt find how to order the sets.. I'll look at using a bag instead.
thnx.


Top
 Profile  
 
 Post subject: actually...
PostPosted: Thu Jan 22, 2004 5:06 am 
Beginner
Beginner

Joined: Thu Oct 02, 2003 5:06 am
Posts: 26
Location: Budapest, Hungary
I am currently using the 'order by' in HQL to do this just because that was the only option I found... but it means that I could never actually use the getChildren() method (since I needed ordering) which would be neater.. codewise at least.. although functionally the same..
thnx again.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 22, 2004 5:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
You should also be able to use set if you use a SortedSet I think


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.