inflearn logo
Khóa học

Khóa học

Chia sẻ kiến thức

Bài viết của 3001

3001 3001

@3001

Số lượng đánh giá đã viết
8
Xếp hạng trung bình
5.0

Bài viết 3

Hỏi & Đáp

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

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

Lượt thích
1
Số bình luận
4
Lượt xem
467

Hỏi & Đáp

@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 (); }

Lượt thích
1
Số bình luận
4
Lượt xem
467