使用SpringBoot做JAVA開發時,用Repository.save();保存數據的時候遇到了報錯:
could not execute statement; SQL [n/a]; constraint [PRIMARY]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement
去搜索了一下解決方法,需要將主鍵設置自增,雖然不清楚為什么,但是將主鍵設置自增之后確實解決問題了,以后清楚原因之后再來補上。