써먹는 웹개발

[Jpa] Error : No default constructor for entity 해결방법 본문

웹개발/Jpa

[Jpa] Error : No default constructor for entity 해결방법

kmhan 2021. 12. 8. 12:46


728x90
반응형

에러 메세지 : 'nested exception is org.hibernate.InstantiationException: No default constructor for entity'

 

JPA에서 Entity는 기본 생성자를 가지고 있어야 한다는 제약조건이 있는 듯 하다

 

기본생성자를 생성하거나 @NoArgsConstructor을 추가하면 해결된다.

 

+ @NoArgsConstructor 작성시 @Builder에서 오류가 날 수 있는데, @AllArgsContructor을 쓰면 해결된다.

 

※ 출처 : https://catchdream.tistory.com/128

728x90
반응형


Comments