Has Spring-boot changed the way auto-increment of ids works through @GeneratedValue?

后端 未结 4 1776
难免孤独
难免孤独 2021-02-12 20:25

Spring-Boot 2.0.0 seems to have modified the way Hibernate is auto configured.

Let\'s suppose two simple and independent JPA entities:

4条回答
  •  梦谈多话
    2021-02-12 20:55

    If you are in need for a quick, not future-proof solution to prevent this issue from happening:

    spring.jpa.hibernate.use-new-id-generator-mappings=false, as from the Spring Boot 2 docs:

    spring.jpa.hibernate.use-new-id-generator-mappings= # Whether to use Hibernate's newer IdentifierGenerator for AUTO, TABLE and SEQUENCE.

    This will prevent from using the new generators and keep the old functionality included in Spring boot 1.x.x.

    Please note that this is probably not the best solution, but it is very helpful on short term

提交回复
热议问题