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

后端 未结 4 1777
难免孤独
难免孤独 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:06

    You can use

        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private Long id;
    

    to use MySQL autoincrement.

提交回复
热议问题