| We have OneToMany relation between EntityA and EntityB, the @BatchSize is used. And EnittyB using SingleTable inheritance strategy,the primary table is TABLE_B_PARENT, the child class EntityB_Child1 inherit EntityB,and uses @SecondaryTable TABLE_B_CHILD. When loading EntityA and EntityB, hibernate will generate following sql: Step 1) select * from TABLE_A where id=1 Step 2) select * from TABLE_B_PARENT where table_a_id=1; – return record 101,102,103 or select * from TABLE_B_PARENT where table_a_id in(1,2,3,..); – if there is multiple A loaded. Step 3) select * from TABLE_B_CHILD where table_b_parent_id=101; select * from TABLE_B_CHILD where table_b_parent_id=102; select * from TABLE_B_CHILD where table_b_parent_id=103; The Step 3 donesn't using batch load, the performance is pool. Can it be optimized with batch sql support,like select * from TABLE_B_CHILD where table_b_parent_id in(101,102,103); |