Hi,
I use Hibernate 4.1.2.Final together with the MySQL JDBC driver. I have set the hibernate.jdbc.batch_size in persistence XML to enable the batch mode. I have also added rewriteBatchedStatements=true to the MySQL JDBC driver URL. Otherwise MySQL cannot handle batches.
The problem is: The Entity Foo has the associated entities Bar with a OneToMany association. Now the following happens: Each entity Foo is persisted one by one, then the join list Bar_Foo only for this Foo is written in a batch and the Bars only for this Foo are written in a batch. So if I have 1000 Foos these 1000 Foos are not written in a batch, but one by one. What I want is that all Foos are written in a batch, then all join lists Foo_Bar for all Foos and then all Bars for all Foos written, so 3 MySQL INSERT statements instead of 3000. Is this possible?
Thanks
|