开发者

Dynamic queries with hibernate

开发者 https://www.devze.com 2023-02-06 11:29 出处:网络
I have an application where i need to enable end users to create adhoc reports by defining their options through some type of wizard whose process would be something like:

I have an application where i need to enable end users to create adhoc reports by defining their options through some type of wizard whose process would be something like:

1) User sel开发者_开发技巧ects the table(s) he wants to query  (eg person, project, activities)
2) defines the list of fields he requires (eg name, email, projects, activity, activity info) 
3) supplies the filter criteria for the records to return (eg Person name, ongoing activities)

I am using hibernate with postgres database with more than 100 tables. Sure, I can not let the user pick any of those tables since they make no sense. But some 10 main tables (such as ones from above).

So I need advice on how to:

  1. Is it possible and how to define joins and relations between these tables and their other relations dynamically?
  2. If not, (or too complex), what would be the best way to predefine these joins and database paths, and then let user only parametrize filters?
  3. Obtain data from more than one hibernate object and then let the user chooses fields he wants.

I appreciate much all the feedback, if i did not explain the need properly please write.


http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html_single/#querycriteria

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号