What exactly does Hibernate new_generator_mappings actually do?
Asked Answered
F

1

26

New to Spring Boot/JPA/Hibernate and I'm trying to understand what the hibernate.id.new_generator_mappings property actually does.

According to that doc, it:

"...directs how identity or sequence columns are generated when using @GeneratedValue"

But it doesn't really explain the behavioral difference from when its true vs when its false. Any ideas?

Fitzgerald answered 6/4, 2017 at 19:24 Comment(1)
A good explanation can be found here: vladmihalcea.com/…Strophic
P
14

This ‘hibernate.id.new_generator_mappings’ by default is false which uses the ‘SequenceHiLoGenerator‘ which will have that multiply behavior. Once we set it to true, it will then use the ‘SequenceStyleGenerator‘, which is more jpa and oracle friendly. It generates identifier values based on an sequence-style database structure. Variations range from actually using a sequence to using a table to mimic a sequence.

Source: https://vcfvct.wordpress.com/2016/04/23/jpa-sequencegenerator-with-allocationsize-1-performance-tuning/

Propylaeum answered 27/7, 2018 at 16:12 Comment(1)
As of Hibernate version 5, the default value of the property is true.Pauperize

© 2022 - 2024 — McMap. All rights reserved.