I’ve just hit this issue in Hibernate 5.4.12 Final (upgraded from Hibernate 4.3.x) against Postgres, same symptom - Hibernate attempts to insert a PK that is the DBs’s nextval - allocationSize (which defaults to 50 on the JPA @SequenceGenerator annotation). We didn’t have the same issue with Hibernate 4.3
Setting hibernate.id.optimizer.pooled.prefer_lo to true as mentioned by the original reporter also fixed the issue for me. I will try to attach a unit test to reproduce when I get time. |