记录错误的处理方法
1、首先在主键的属性上加主键自增注解
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
2、然后测试
public void test01(){
studentRepository.save(new Student("张三", 23));
studentRepository.save(new Student("李四", 22));
}
3、结果