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 : Size of Set
PostPosted: Mon Sep 22, 2008 6:53 am 
Newbie

Joined: Mon Sep 22, 2008 6:36 am
Posts: 1
Hi,

how can I order my result set by the size of a set ( i do not want to sort the set itself, i want to get the users with the most certificates first )

What is the correct way to do this ?

Thanks


Hibernate version:
3.2.6

Mapping documents:
<class name="User" table="user" batch-size="20">
<set name="certificates" table="certificate_info" inverse="true" batch-size="20">
<key column="user_id" />
<one-to-many class="de.tendme.backend.model.certificate.CertificateInfo"/>
</set>
</class>


Name and version of the database you are using:

MySQL 5.1

The generated SQL (show_sql=true):

[ from de.tendme.backend.model.Provider p where p.user.userState=? and p.user.country.id =? and p.activated = true ORDER BY p.user.certificates DESC]

SQL : select [...] where [...] user1_.country_id=? and petcarepro0_1_.is_activated=1 order by . DESC


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 22, 2008 3:15 pm 
Expert
Expert

Joined: Mon Nov 26, 2007 2:29 pm
Posts: 443
We had an extensive discussion in this forum, including some problems that occur for particular databases.

_________________
Gonzalo Díaz


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.