본문 바로가기

성장 일기/오류 해결

[Spring/SQL/IntelliJ] nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement (2021-08-29)

오류

위 오류 사진을 보면 Field 'id' doesn't have a default value.라고 나와있다. 

 

이는 id가 not null 설정되어있는데 default값으로 저장되어 생기는 오류이다. 

 

알고보니, id를 처음 설정해줄 때 auto increment 설정을 해줬어야 했는데 해주지 않아 id값이 자동으로 저장되지 않았던 것이었다. 

 

AI ( Auto Increment )를 선택해 apply시켜주면 정상적으로 작동한다.