안녕하세요 갈아만든쌀입니다.
오늘은 Spring Boot로 컨틀로러 및 DB 작업 중 상호 무한참조로 인한 데이터 저장 해결을 해보도록 하겠습니다.
목차
- 용어정리
- 문제상황
- 해결방안 비교
- 결론
- 참고자료
용어정리
Owning side : Bi-directional Relation 중 @ManyToOne 어노테이션을 가지고 있는 쪽
Inversed Side : Bi-directional Relation 중 @OneToMany 어노테이션을 가지고 있는 쪽
Entity : 데이터베이스 Table에 대응되는 자바 오브젝트(ORM)
1. 문제상황 및 엔티티 구성
User : Inversed side(@OneToMany) --> UserPreference
Book : Inversed side(@OneToMany) --> UserPreference
UserPreference
- Owning Side(@ManyToOne) --> User
- Owning Side(@ManyToOne) --> Book
엔티티는 위와 같이 구성되어 있습니다. Intellij안의 오류메세지 두줄만 가져오면 다음과 같습니다.
21-12-22 21:55:15.702 ERROR 26728 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Infinite recursion (StackOverflowError); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"]->org.hibernate.collection.internal.PersistentBag[0]->com.example.h2Test.entity.UserPreference["user"]->com.example.h2Test.entity.User$HibernateProxy$y0Sjhjj1["userPreferenceList"])] with root cause
java.lang.StackOverflowError: null
중간에 보시면 Infinite recursion이라고 쓰인것을 볼 수 있습니다.
위와 같이 Entity를 구성한 것은, 한 유저가 한 책에 대해 어떻게 Rating을 했는지 그 이력을 추적하는 용도였습니다.
포스트맨에서 보이는 모습
무한참조로 고장난 모습
포스트맨에서는 위와같이 userPreference안에 user안에 다시 userPreference안에 user안에...무한히 계속되는 것을 볼 수 있습니다.
2. 해결방안 비교
@JsonIgnore 방식 또는 @JsonIdentityInfo 방식
@JsonIgnore | @JsonIdentityInfo | |
장점 | - 편리함 | - 양방향 쿼리 지원 - 하나의 Entity와 연관된 모든 내용 쿼리 |
단점 | - 양방향중, inverse side-> Owning side쿼리가 깨짐 | - 불필요한 내용까지 쿼리 가능성 |
@JsonIdentityInfo 방식
해당되는 모든 Entity위에 같은 내용을 복붙합니다.
@JsonIdentityInfo(
generator = ObjectIdGenerators.PropertyGenerator.class,
property = "id")
예를들면
@Entity
@Data
@JsonIdentityInfo(
generator = ObjectIdGenerators.PropertyGenerator.class,
property = "id")
public class Book {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
@OneToMany(mappedBy = "book", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private List<UserPreference> userPreferenceList;
}
와 같습니다
또한 오류가 하나 나는데 이를 방지하기 위해 다음과 같은 세팅을 application.properties에 해줍시다
spring.jackson.serialization.FAIL_ON_EMPTY_BEANS=false
PostMan을 통해, 각각 데이터를 생성하고 쿼리해보면 다음과 같습니다.
@JsonIgnore 방식
Inversed Side내에 Owning side를 가르키는 곳에 붙입니다
@Entity
@Data
public class Book {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String title;
@JsonIgnore
@OneToMany(mappedBy = "book", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
private List<UserPreference> userPreferenceList;
}
위와 같이 OneToMany가 있는 부분에 @JsonIgnore를 붙입니다.
위 내용을보면, 앞의 방식과 다르게 더이상의 깊은 Query는 하지 않는 것을 볼 수 있습니다.
3. 결론
오늘은 Bi-direction에서 inifinite recursion persistence 문제를 해결해보았습니다. 여러 자료를 찾아봤는데, 어떤것들은 안맞는것도 존재했습니다. 개인적으론 문제를 해결할 정확한 키워드를 찾기가 어려웠습니다. 자바에 대한 좀더 이론적인 공부를 해야하는데 시간 여유가 많진 않네요.
아무튼 제가 다른 코드를 봤을땐 jsonIgnore를 사용하는 것을 볼 수 있었습니다. 아쉬운점은 Bi-directional하게 안된다는 점이 있는데, 이 부분은 안의 로직상으로 처리해야 할 것으로 보입니다.
JsonIdentityInfo를 쓰기도 하지만 깊은 쿼리를 한다는 장점과 다만 데이터가 너무 방대하지 않을까 싶긴하네요
아무쪼록 참고가 되었길 바랍니다.
끝.
그리고 깃허브 주소 https://github.com/Chaeguevara/javaReview/tree/main/h2Test
4. 참고자료
https://www.baeldung.com/jackson-bidirectional-relationships-and-infinite-recursion
https://www.baeldung.com/jpa-many-to-many