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

Criteria OR HQL

 
ramaseshan T
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a large database with multiple relations existing between entities. One set of relations is as shown below

Area (Many to One) ----->MarketMaster (Many to One) -----> Market
(Many to One) --> MarketCluster(Many to One) --->Region

Similarly Area table has lot of relation with many other tables.

My doubts

1. To cater to the fields, operators and values selected by UI, i shd dynamically generate queries. But criteria queries fetch objects as a whole and not individual fields. ("Projections" can be used to select fields, but for choosing Area.MarketMaster.Market.Marketcluster.Region, Can projections be used?

2. Given the scenario of large db and catering to dynamic queries, is it better to use Criteria queries or HQL? How to fetch specific field values using Criteria API..

Please suggest..
 
Sebastian Hennebrueder
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that CriteriaQueries are very useful for dynamic queries. Just try it for your case.

Best Regards

Sebastian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic