异常记录 - org.springframework.dao.DataIntegrityViolationException

973 阅读1分钟

原因:Insert或Update数据时违反了完整性,例如违反了惟一性限制;

操作:

重点:

在实体类的id上加注解(生成策略核心注解):

@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
@GeneratedValue(generator = "jpa-uuid")

修改后: