org.springframework.dao.DataIntegrityViolationException:

tech2026-03-12  5

Error updating database. Cause: java.sql.SQLException: Field ‘id’ doesn’t have a default value

The error may exist in···········

The error may involve·········

The error occurred while ·······

Cause: java.sql.SQLException: Field ‘id’ doesn’t have a default value; Field ‘id’ doesn’t have a default value; nested exception is java.sql.SQLException: Field ‘id’ doesn’t have a default value

此时id字段设置为非null 将报错信息结合id非null于是(此处应该结合具体SQL语句(此处一概而过)——就是没有向id中插入任何数据。) 从此可分析出解决办法 1:插入数据 2:将id设置允许null

最新回复(0)