에러

프로젝트

목록 보기
14/39

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: java.util.ArrayList[0]->com.myomi.cart.dto.CartReadResponseDto["product"]->com.myomi.product.entity.Product["cart"]->org.hibernate.collection.internal.PersistentBag[0]->com.myomi.cart.entity.Cart["user"]->com.myomi.user.entity.User["membership"]->com.myomi.membership.entity.Membership$HibernateProxy$tN1C6hLg["hibernateLazyInitializer"])
->
1. membership(user에서 @ManyToOne으로 가짐)에 fetch.Lazy를 넣어줌
2. Cart에서 User와 Product를 ManyToOne 양방향으로 가지고 있으면 user와 product엔티티의 OneToMany 변수들을 다 JsonIgnore 처리해줘야 됨

cannot call senderror() after the response has been committed~~
: 순환참조 문제, jsonignore추가


문제

  • jsonignore로도 해결 안되는 문제가 있었는데, User 엔티티에서 point와 seller를 OneToOne관계로 가지고 있을때, N+1 문제가 발생한다.

  • https://devlog-wjdrbs96.tistory.com/432
    @OneToOne 관계에서는 연관관계의 주인이 아닌 곳에서 조회할 때 N+1문제가 생긴다고 한다...
    https://wave1994.tistory.com/156
profile
백엔드를 공부하고 있습니다.

0개의 댓글