Back End/JPA

    728x90
Back End/JPA

[JPA] JPA auto-increment 하는 방법, not null 에러 해결법

@Id @GeneratedValue(strategy = GenerationType.IDENTITY) // Auto Increment 설정 @Column(name = "user_id") private Integer userId;  Not null 은 GeneratedValue 를 설정해주면 된다. 그런데 위와 같이 설정했는데도, insert 를 실행할 때 아래와 같은 에러가 발생했다.  @GeneratedValue(strategy = GenerationType.IDENTITY) // Auto Increment 설정  null value in column "user_id" of relation "users" violates not-null constraint ERROR: null val..

    반응형
Lar
'Back End/JPA' 카테고리의 글 목록