Not sure if this is exactly the same problem as [ HHH-13676 ] and [ HHH-13674 ] since my set up is slightly different? As far as I can see the problem does not depend on the underlying DB engine since we do have it with H2 as well as PostgreSQL. I think it is a problem of the used sequence generator algorithm. In particular, HiLo increment size has nothing to do with the DB increment size since it is completely independent and sequence ids are never exactly reflected by DB sequence numbers with this algorithm, cf. [https://vladmihalcea.com/the-hilo-algorithm/|https://vladmihalcea.com/the-hilo-algorithm/] of @vladmihalcea.
I already brought up the issue on Stack Overflow, cf. [ https://stackoverflow.com/questions/59305427/org-hibernate-mappingexception-the-increment-size-of-the-sequence-is-set-to-10 |https://stackoverflow.com/questions/59305427/org - hibernate-mappingexception-the-increment-size-of-the-sequence-is-set-to-10] - it was considered an error by @jensschauder of the Spring Data team.
We do have the following sequence generator
{code :java } @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "hilo_sequence_generator") @GenericGenerator( name = "hilo_sequence_generator", strategy = "...", parameters = { @Parameter(name = "sequence_name", value = "XXX_SEQUENCE"), @Parameter(name = "initial_value", value = "1"), @Parameter(name = "increment_size", value = "10"), @Parameter(name = "optimizer", value = "hilo") }) private Long id; {code}
With the update to SB 2.2 / HB 5.4 we get the following initialization error
{code :java } org.hibernate.MappingException: The increment size of the sequence is set to [10] in the mapping while the associated database sequence increment size is [1] {code}
SO already contains some more information (stack traces etc.). But I also compiled a small (Spring Boot) project to show the issue: [ https://github.com/ascheman/hibernate-so-59305427 |https://github.com/ascheman/hibernate-so-59305427]
I consider the priority major since it prohibits us from upgrading to a clean SB 2.2 / Hibernate 5.4., but we can still use HB 5.3.x to prevent the problem. |
|