-->
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.  [ 3 posts ] 
Author Message
 Post subject: Sorting a list of items base on the size of the item's set
PostPosted: Wed Feb 02, 2005 7:45 pm 
Beginner
Beginner

Joined: Wed Sep 15, 2004 3:14 am
Posts: 35
Hi

How can I sort a list of items base on the size of the item's set? e.g.

Code:
public class User{
   private Set posts;

   public getPosts() {
        return posts;
   }

    public setPosts(Set posts) {
        this.posts = posts;
    }
}


I use the following HSQL, but it doesn't work:

Code:
from User u order by u.posts.size sort by asc


Can someone please help me?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 5:39 am 
Beginner
Beginner

Joined: Wed Sep 15, 2004 3:14 am
Posts: 35
Does Hibernate support this sort of thing?

It amazes me that no one has faced this problem.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 09, 2005 5:42 am 
Newbie

Joined: Wed Sep 01, 2004 9:04 am
Posts: 18
Location: Enschede, Netherlands
I think HQL does, check the reference documentation

http://www.hibernate.org/hib_docs/reference/en/html/queryhql.html#queryhql-ordering


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