JPA] LAZY 로딩으로 인한 JSON 직렬화 오류


JPA] LAZY 로딩으로 인한 JSON 직렬화 오류

JPA에서 객체 로딩 전략을 LAZY로 할 시 사용하지 않는 객체는 PROXY로 조회되어 JSON직렬화를 수행 할 수 없어서 아래와 같은 에러가 난다. Request processing failed; nested exception is org.springframework.http.converter.HttpMessageConversionException: Type definition error: [simple type, class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties discovered to create BeanSerializer (to avoid exception..........



원문링크 : JPA] LAZY 로딩으로 인한 JSON 직렬화 오류