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.
Please clarify:
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.regionname, Can projections be used?
For example to select area name (From Area table), Market name (From Market table), which belongs to region EAST (From region table), how to use Projections?
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 Criterion API..
Please suggest..
|