SpringBoot保存数据报错:could not execute statement; SQL [n/a]; constraint [PRIMARY];nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

使用SpringBoot做JAVA开发时,用Repository.save();保存数据的时候遇到了报错:

could not execute statement; SQL [n/a]; constraint [PRIMARY]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement

去搜索了一下解决方法,需要将主键设置自增,虽然不清楚为什么,但是将主键设置自增之后确实解决问题了,以后清楚原因之后再来补上。

原文地址:https://www.cnblogs.com/stilldream/p/11301330.html