# 깃에 민감정보가 커밋되어서 올라가 버리는 바람에 모든 브랜치와 메인 브랜치를 되돌려야 했다.
일단 첫 번째로 main브랜치를 민감정보가 올라가기 전 까지로 Hard 초기화시켰다.
그리고 Hard초기화 된 코드를 main브랜치를 푸쉬해줬다.
두 번째로 내 브랜치에서 민감정보가 들어오기 전 까지로 Hard 초기화를 시켰다. 그런 다음
내 브랜치에다가 되돌려진 Hard초기화된 코드를 다시 푸쉬해줬다.
인텔리제이 터미널에 git push [브랜치이름] -f
main 이미지 업로드 기능 까지
YSH Team, User, Meeting, Issue 기능 구현 까지
ssw build gradle 추가 까지
동관님 이미지 업로드 기능 까지
인줄 알았는데... gitignore 생성이라는 커밋부터 민감정보가 포함되어 있었기 때문에
모두가 가진 gitignore 까지로 모든 브랜치로 초기화시켰다.
만약에 제거된 브랜치가 여전히 소스트리에 찍혀나온다면
패치에서 '리모트에서 제거된 브랜치 제거하기'에 체크해주면 된다.
#gitignore
**/application-google.properties
**/application-email.properties
이렇게 추가해주니 잘 된다.
# query did not return a unique result: 2;
이런 에러가 발생했는데
List<객체> findAllby 가 아닌,
이건 객체를 findAllby~~ 로 찾아서 발생한 오류같다.
즉, List<객체> findAllby~~ 로 하면 해결될 것.
# @JsonManagedReference, @JsonBackReference
어노테이션들로 문제가 발생했다.
Meeting 엔티티의 OneToMany에 @JsonManagedReference가 있고,
Issue 엔티티의 ManyToOne에 @JsonBackReference가 없으면
Issue가 여러개일 때,
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at JPLISAgent.c line: 844
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at JPLISAgent.c line: 844
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message transform method call failed at JPLISAgent.c line: 844
java.lang.IllegalStateException: Cannot call sendError() after the response has been committed
ERROR 5000 --- [nio-8080-exec-1] 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.team.unanimous.model.meeting.Meeting["meetingIssue"]->org.hibernate.collection.internal.PersistentBag[0]->com.team.unanimous.model.meeting.Issue["meeting"]->com.team.unanimous.model.meeting.Meeting["meetingIssue"]->org.hibernate.collection.internal.PersistentBag[0]->com.team.unanimous.model.meeting.Issue["meeting"]->com.team.unanimous.model.meeting.Meeting["meetingIssue"]->org.hibernate.collection.internal.PersistentBag[0]->com.team.unanimous.model.meeting.Issue["meeting"]->com.team.unanimous.model.meeting.Meeting["meetingIssue"]->org.hibernate.collection.internal.PersistentBag[0]->com.team.unanimous.model.meeting.Issue["meeting"]->com.team.unanimous.model.meeting.Meeting["meetingIssue"]->org.hibernate.collection.internal.PersistentBag[0]->com.team.unanimous.model.meeting.Issue["meeting"]->com.team.unanimous.model.meeting.Meeting["meetingIssue"]->org.hibernate.collection.internal.PersistentBag[0]->com.team.unanimous.model.meeting.Issue["meeting"]->com.team.unanimous.model.meeting
이런 오류들이 주우우우욱 나타난다.
OneToMany에 @JsonManagedReference가 없고, ManyToOne에 @JsonBackReference가 있으면
미팅이 여러개일 때, 저런 에러가 나타난다.
즉, OneToMany와 ManyToOne 로 묶여있는 연관관계에서는 해당 어노테이션들을 잘 넣어주자..
# update메서드가 안 먹힐때,
sout 로 찍어도 바뀌는데 DB에 적용이 안 될 때는
update 아래에
마지막으로 repository.save 를 해주면 잘 적용된다.
#@JsonManagedReference
@JsonBackReference
OneToMany <-> ManyToOne
연관관계에서 무한참조를 막아주는 어노테이션.
없으면 stackOverFlow 에러가 발생한다.
# A엔티티와 B엔티티
A에 B가 여러개고, B에 A가 여러개일때
ManyToMany <-> ManyToMany로 해결할 수 있지만
이렇게 연관관계를 구축하면, 이후 코드의 세부적인 유지보수가 힘들기 때문에,
가상의 C 엔티티를 만들어서
A-C OneToMany <-> ManyToOne,
C-B ManyToOne <-> OneToMany
로 ManyToMany <-> ManyToMany 관계를 풀어서 만들 수 있다.
'TIL' 카테고리의 다른 글
220701 TIL 실전프로젝트 트러블슈팅 (1) | 2022.07.04 |
---|---|
220630 TIL 실전프로젝트 트러블슈팅 (0) | 2022.07.04 |
220629 TIL 실전프로젝트 트러블슈팅 (0) | 2022.06.30 |
220627 슬랙클론코딩 WIL (0) | 2022.06.27 |
220622 TIL 클론코딩 트러블슈팅 (0) | 2022.06.23 |