반응형
javax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save()

오류 : JPA를 사용할 때 PK인 컬럼을 도메인에 설정해주어야 함

 

해결 : @GeneratedValue 자동생성

    @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

*식별자를 직접 할당하는 방법도 있음

반응형