-->
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: Order by collection size with criteria
PostPosted: Tue Sep 02, 2008 9:59 am 
Newbie

Joined: Tue Sep 02, 2008 9:53 am
Posts: 6
Hibernate version:
Whatever ships with JBoss 4.2.2GA

Name and version of the database you are using:
Oracle 11


Hi,
is there any way to order a criteria result by the size of a collection? It's pretty easy with HQL ("... order by size(foo) ..."), but I can't find a way to to this when using criterias.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 02, 2008 10:36 am 
Newbie

Joined: Tue Sep 02, 2008 9:53 am
Posts: 6
I did some more searching, and it seems that using "@Formula" is the only way.
I've never worked with @Formula before, so I've created a new formula column for testing, but it doesn't seem to work. If definded the column with
Code:
@Formula(value="1*1")
public Integer foo;

Is this wrong? Google doesn't return anything helpful about the formula annotation.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 12, 2009 10:23 am 
Newbie

Joined: Tue Sep 02, 2008 9:53 am
Posts: 6
I ran into the same problem again. Last time I "solved" it by simply not using criteria, but this time I'll have to.
Is there any way to this? This is really important


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.