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

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

posted @ 2019-08-05 10:03  还可入梦  阅读(15829)  评论(1编辑  收藏  举报