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.  [ 1 post ] 
Author Message
 Post subject: HQL parametrized sorting
PostPosted: Wed Oct 14, 2009 3:40 am 
Newbie

Joined: Mon Aug 31, 2009 6:30 am
Posts: 9
Location: Bolzano, Italy
Hello all,

I habe the following problem: I have an hql query where I would like to pass both order property and sort direction as a parameter. Only passing the order-by property as a parameter works fine. In such case, the query looks like the following:

select h from House h order by :pOrderBy

However, when I also try to add the sort direction as a parameter (passing effectively "asc" and "desc" using the .SetString() method), then it fails (issuing "Errors in named queries"). In such case, the query looks like the following:

select h from House h order by :pOrderBy :pSortDirection

Do you have any ideas how I could solve the problem? If possible, without using .AddCriteria(Order.Asc)

Thanks in advance!

Best regards,
Martin

_________________
Tutorials and solved problems under:
http://angler.wordpress.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.