我有一个包含 ManyToMany 关系的模型:
@JoinTable(name = "Contract_has_Institution", joinColumns = { @JoinColumn(name = "contract_id", referencedColumnName = "id") }, inverseJoinColumns = { @JoinColumn(name = "institution_id", referencedColumnName = "id") })
@ManyToMany
public List<Institution> institutionCollection;
在 scala.html 我有两个选择,在列表中添加两个元素(两个机构)
@select(contractForm("institutionCollection"),
options = options(InstitutionController.options),
'_default -> "--- Choose an institution ---",
'_label -> "Institution A",
'_showConstraints -> false)
@select(contractForm("institutionCollection"),
options = options(InstitutionController.options),
'_default -> "--- Choose an institution ---",
'_label -> "Institution B",
'_showConstraints -> false)
我试过将 [] 添加到这样的字段中
contractForm("institutionCollection[]"),
但它不起作用。如何将两个选定的选项绑定到列表?