JPA中MYSQL生成id,如果使用:

@Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;

那么在id的生成中,mysql就会使用sequence,会报一个hibernate_sequence表的错误。could not read a hi value - you need to populate the table: hibernate_sequence

解决方法:

@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;
02-15 16:23