Hi
I have a one to many relationship R1 between two tables T1 & T2 ( Classes C1 & C2 )and i have mapped the relationship with list element.
I have enabled collection cache for R1 and class cache for C2.
I have batch-size attribute set on collection R1 and class C2 class.
When I try to load C1 & C2 instances ( which have lazy="false" )
-the first time instances of C2 are loaded, they are loaded in batch which is desired,
-subsequent attempts cause seperate queries being issued to load C2 instances one for each instance of C1.
I have query cache enabled as well.
I tried different collection elements as well ( list, set, bag ) neither helped.
Since the number of instances of C2 are huge, the transaction is timing out. Why is batch-size behaving correctly the first time but cause the n+1 selects afterwards? Any help would be appreciated.
Thanks
Sreeram
|