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

后端 未结 4 1770
难免孤独
难免孤独 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 21:02

    Spring Boot 2.0 uses Hibernate 5.2 (https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Release-Notes).
    Hibernate changes its GeneratedType.AUTO strategy since 5.2. Any database that does not support sequences natively (e.g. MySQL), they use the TABLE generator instead of IDENTITY. (https://hibernate.atlassian.net/browse/HHH-11014)

    That's why GeneratedType.AUTO does not work as you expected.

提交回复
热议问题