When using JOINED inheritence strategy hibernate is not ordering inserts and as a result batch inserts are not working. This is causing a performance hit. Is there any way to keep using the strategy and configure hibernate to order the inserts? I have used id generation strategy as sequence so that is not the issue.
As an example say we have abstraction Animal
. Dog
, Cat
etc.. are the concrete entities.
Following are the operations.
Animal a = new Dog();
Animal b = new Cat();
save(a);
save(b);
SQL statements in console that are logged.
insert into animal...;
insert into dog...;
insert into animal...;
insert into cat...;
What I expect hibernate to do..
insert into animal...;
insert into animal...;
executing batch of size 2;
insert into dog..;
insert into cat..;