Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 2.25 KB

File metadata and controls

23 lines (17 loc) · 2.25 KB

Why And How To Avoid The AUTO Generator Type In Hibernate 5 And MySQL

If you prefer to read it as a blog-post containing the relevant snippets of code then check this post

Description: In MySQL & Hibernate 5, the GenerationType.AUTO generator type will result in using the TABLE generator. This adds a significant performance penalty. Turning this behavior to IDENTITY generator can be obtained by using GenerationType.IDENTITY or the native generator.

Key points:

  • use GenerationType.IDENTITY instead of GenerationType.AUTO
  • use the native generator - exemplified in this application

Output example:


If you need a deep dive into the performance recipes exposed in this repository then I am sure that you will love my book "Spring Boot Persistence Best Practices"If you need a hand of tips and illustrations of 100+ Java persistence performance issues then "Java Persistence Performance Illustrated Guide" is for you.