inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

3001님의 게시글

3001 3001

@3001

수강평 작성수
8
평균평점
5.0

게시글 3

질문&답변

@ManyToMany에 관련된 질문입니다.

감사합니다! 해결했습니다. 클래스전체에 @Builder를 적용하지않고 엔티티에 따로 생성자를 만들어 @ManyToMany처럼 연관관계를 제외한 부분만 빌더 패턴으로 받을수 있게 했습니다.

좋아요수
1
댓글수
4
조회수
471

질문&답변

@ManyToMany에 관련된 질문입니다.

맞습니다. Setter를 쓰지 않기위해서 빌더를 써서 만들었는데 그렇다면 Setter를 사용하여 modelMapper를 이용해 바인딩해서 만드는 방법밖에 없는건가요? @PostMapping ( "/new-society" ) public String newSocietySubmit ( @CurrentAccount Account account , @Valid SocietyForm societyForm , Errors errors , Model model ) { if ( errors . hasErrors ()) { model . addAttribute ( "account" , account ); return "society/form" ; } Society newSociety = Society . builder () . path ( societyForm . getPath ()) . title ( societyForm . getTitle ()) . shortDescription ( societyForm . getShortDescription ()) . fullDescription ( societyForm . getFullDescription ()) . build (); Society society = societyService . createNewSociety ( newSociety , account ); return "redirect:/society/" + society . getEncodedPath (); }

좋아요수
1
댓글수
4
조회수
471