DEV Community

Discussion on: Best Possible Hibernate Configuration for Batch Inserts

 
smartyansh profile image
Anshul Bansal
Thread Thread
 
digvijayah02 profile image
djyo02
Thread Thread
 
mwaseemmnnit profile image
Mohd Waseem

why " 'pooled' optimizer strategy work with MySql database and Hibernate " does not work?
I tried this example and it worked below are the versions that i have used:

  • mysql Ver 14.14 Distrib 5.7.30, for Linux (x86_64) using EditLine wrapper
  • hibernate: hibernate-core:jar:5.4.8.Final:compile Hibernate is using a table hibernate_sequence and first getting id and caching it, then using those ids to insert record. I had enabled hibernate statistics:

Session Metrics {
1720780 nanoseconds spent acquiring 2 JDBC connections;
15750 nanoseconds spent releasing 1 JDBC connections;
110738 nanoseconds spent preparing 3 JDBC statements;
1044388 nanoseconds spent executing 2 JDBC statements;
13444485 nanoseconds spent executing 1 JDBC batches;
0 nanoseconds spent performing 0 L2C puts;
0 nanoseconds spent performing 0 L2C hits;
0 nanoseconds spent performing 0 L2C misses;
44990162 nanoseconds spent executing 1 flushes (flushing a total of 50 entities and 0 collections);
0 nanoseconds spent executing 0 partial-flushes (flushing a total of 0 entities and 0 collections)
}
This looks line Table generator but i use the generator code from this post.

Thread Thread
 
mwaseemmnnit profile image
Mohd Waseem

Hibernate is created hibernate_sequence table when i used sequence generator. Since mysql doesnt support sequence generator hibernate fall back to table generator due to which i was able to run example mentioned in the post.