@Data
public class ContentCrew {
@Id
@GeneratedValue
private Long contentCrewId;
@ManyToOne
@JoinColumn
private Content content;
@ManyToOne
@JoinColumn
private Crew crew;
@Enumerated
private CrewRole role;
}
< /code>
контроллер для этого < /p>
@GetMapping({"/admin/content/add", "/admin/content/add/"})
public String getContentAdd(Model model){
model.addAttribute("contentForm", new NewContentForm());
model.addAttribute("contentTypes", contentTypeService.getAllContentTypes());
model.addAttribute("countries", countryService.getAllCountries());
model.addAttribute("genres", genreService.getAllGenres());
model.addAttribute("languages", languageService.getAllLanguages());
model.addAttribute("crewList", crewService.getAllCrew());
model.addAttribute("crewRoles", CrewRole.values());
return "/admin/content/add";
}
< /code>
newcontentform dto: < /p>
@Data
public class NewContentForm {
private Content content;
private Long contentTypeId;
private Set countryCodes;
private Set genreIds;
private Set languageCodes;
}
< /code>
my thymeleaf form
< /p>
Add New Content
Add Content Details
Title
Synopsis
Portrait Url
Landscape Url
Select Content Type
Countries
Hold Ctrl (Windows) or Cmd (Mac) to select multiple.
Genres
Hold Ctrl (Windows) or Cmd (Mac) to select multiple.
Languages
Hold Ctrl (Windows) or Cmd (Mac) to select multiple.
Back
Save
< /code>
Как я могу добавить здесь новые вещи, а у меня нет единого сущности, которая содержит все поля, такие как содержание, все его метаданные. Таким образом, мне придется использовать службы соединения, чтобы получить все вещи по контенту, который может быть неэффективным. Лучший способ сделать это?
Подробнее здесь: https://stackoverflow.com/questions/797 ... in-springb
Мобильная версия