-->
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: How to modify a named query at runtime?
PostPosted: Wed Dec 14, 2005 10:20 am 
Newbie

Joined: Wed Dec 14, 2005 10:09 am
Posts: 1
Hi, I have looked around trying to find how to modify in runtime a query that I use in an hbm.xml file. I need to change it because the query must adapt to the user's requests, e.g: to change the sort order of the query or to modify the where clause conditions. It is quite impractical to simply add new querys to satisfy each case or to use a stringbuffer in the code, it is supposed to be better not to hardwire the query. Can someone help me with this?

Hibernate version: 3.0


Name and version of the database you are using: PostgreSql 8


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 12:29 pm 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
Have you tried using the Criteria API instead of using a named query? This is exactly the kind of thing that Criteria stuff is made for.

http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#querycriteria

_________________
nathan


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.