springBoot+jpa 测试自增时数据库报错Springboot-jpa Table 'sell.hibernate_sequence' doesn't exist

报错信息如下:

实体类对象为:

@Data
@Entity
@DynamicUpdate
public class ProductCategory implements Serializable{

    @Id
    @GeneratedValue
    private Integer categoryId;

    /**
     * 类目名字
     */
    private String categoryName;

    /**
     * 类目编号
     */
    private Integer categoryType;
}

解决方法:

@GeneratedValue(strategy = GenerationType.IDENTITY)

配置一下主键生成策略@GeneratedValue(strategy = GenerationType.IDENTITY)如果不配置的话默认为@GeneratedValue(strategy = GenerationType.AUTO)的;

查看主键生成策略请点击:https://blog.csdn.net/weixin_44299027/article/details/92799877

原文地址:https://www.cnblogs.com/no8g/p/13415610.html