关于使用springboot中dataJPA报错Table 'test.hibernate

    xiaoxiao2024-11-27  92

    问题所在

    在springboot中使用dataJPA往mysql数据库中插入数据的时候报错

    Table 'test.hibernate_sequence' doesn't exist

    说是啥表不存在

    解决方法

    将主键的生成策略改为如下即可

    @GeneratedValue(strategy = GenerationType.IDENTITY)

    原因:

    因为我们在设计数据库的时候,规定了数据库的主键为自动增长类型

    最新回复(0)