2018-12-07 hibernate主键生成策略

继承的类可以生成独立的表而不是与父类共用一张表
application.properties设置
spring.jpa.hibernate.use-new-id-generator-mappings=true

父类主键生成策略设置为GenerationType.TABLE
如下

    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "idGenerator")
    @TableGenerator(name = "idGenerator", allocationSize = 1)
    @Info(label = "id", placeholder = "", tip = "", help = "", secret = "")
    private Integer id;

具体可继续百度

你可能感兴趣的:(2018-12-07 hibernate主键生成策略)