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: pass in parameters to ORDER BY in HQL?
PostPosted: Wed Jul 28, 2004 2:43 pm 
Beginner
Beginner

Joined: Thu Jul 22, 2004 8:09 am
Posts: 20
Can I have bind variables in the order by clause in HQL like

Select from Object a where a.name=? order by ?

Thanks


Top
 Profile  
 
 Post subject: these aren't bind parameters...
PostPosted: Wed Jul 28, 2004 3:03 pm 
Regular
Regular

Joined: Mon Sep 29, 2003 9:39 am
Posts: 67
If I understand correctly, you'd like to dynamically specify properties to sort by in your HQL.
See "14.3 Ordering Results" in the Hibernate Reference manual.
If you build your Criteria on the fly, you can specify Order objects:
...addOrder(Order.asc("name"))...
from the example. Hope that helps.


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.