자바 & 코틀린
[코틀린 + JPA] Entity 기본 생성자 추가하기
longbeom
2022. 9. 16. 19:49
코틀린으로 Spring Boot, JPA 환경에서 개발 중에 다음 에러가 발생했다.
nested exception is org.hibernate.InstantiationException: No default constructor for entity
JPA Entity는 파라미터가 없는 기본 생성자가 필요한데 없어서 에러가 발생했다.
해결은 kotlin-jpa 플러그인을 추가해서 쉽게 해결할 수 있다.
build.gradle.kts 파일에 추가하면 된다.
apply(plugin = "kotlin-jpa")