-->
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: Question regarding criterias and sort order
PostPosted: Wed Nov 08, 2006 4:34 am 
Newbie

Joined: Tue Oct 03, 2006 9:22 am
Posts: 11
Hey, I have a quick question about sortorder when using building a query using criterias.

I have an Hoering object with an Hoeringstype object and I would like to sort the Hoering's by the Hoeringstype.name property. Is this possible ?
I've tried to do an addOrder(Order.asc("hoeringstype.name")) to my criteria, but that throws an
org.hibernate.QueryException: could not resolve property: hoeringstype.name of: com.nnit.hoeringsportal.domain.Hoering

If I just addOrder(Order.asc("hoeringstype")) then I get the results sorted by the foreign key (and my Hoeringstype isnt in alphabetical order in the database because the user can create new types on the fly).

Is there another way to set the order of my Criteria to achieve this ?

/Steen


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 08, 2006 4:47 am 
Newbie

Joined: Tue Oct 03, 2006 9:22 am
Posts: 11
heh, never mind...that will teach me to search the forums more throughly first...its been covered a few times already.

create an alias and order by that one instead....

/Steen


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 22, 2007 4:57 pm 
Newbie

Joined: Tue Dec 12, 2006 5:01 am
Posts: 11
It's annoying though, isn't it?

Please have a look on this thread and my proposed fix.

Regards
Joerg


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.