Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generating queries on the fly

 
Harsha Pherwani
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
We are building a new application. I want to have an interface to Hibernate from my application which will generate Hibernate queries on the fly depending on the input provided.

My concern is that Hibernate requires alias names before the column names in select stmts, in the where clause, in from clause. Also, how would you build a where clause dynamically when you have to do grouping of the conditions.

If anyone has ever worked with generating dynamic queries, please point out what I could do or if I am missing something.

All inputs will be appreciated.

Harsha

[ August 23, 2005: Message edited by: Harsha Pherwani ]
[ August 23, 2005: Message edited by: Harsha Pherwani ]
 
Nick Heudecker
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out Hibernate's Criteria API. It allows you to build queries programmatically and is well suited to what you want to do.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic