I have the following structure
Store
Rebate
RebateMetadata
RebateCommission
So, the relation is like this -
Store -> Rebate is a one to many relation Rebate -> RebateMetadata is a one-to-one mapping Rebate -> RebateCommission is a one-to-one mapping
My Query is to load all stores. And with it, load all Rebates and metadatas and commissions.
The HQL I am using is:
Select store from Store as store;
I am expecting the whole graph to be loaded in as less SQLs as possible. To prevent the n+1 selects issue, I use subselect fetching between Store->Rebate.
However, to fetch RebateMetadata and RebateCommission, I see multiple individual selects(with joins) being fired. What should I do to minimize this?
Moreover, I have the 2nd level cache turned ON, but QueryCache turned OFF.