我正在使用 Spring Data 在 MySql 数据库上进行选择操作。
我正在尝试通过 listOfWhomHelp
获取所有机构。我期望包含 listOfWhomHelp
的所有记录(institutions
),但是如果我在 listOfWhomHelp
中选择多个元素,它会抛出我:
java.sql.SQLException: Operand should contain 1 column(s)
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)
存储库方法
List findAllByWhomHelp(List institutionListOfWhomHelp);
服务方式
public List findInstitutions(Institution institution) throws NullPointerException {
if(institution.getInstitutionLocations().isEmpty()){
return institutionRepository.findAllByWhomHelp(institution.getWhomHelp());
}
}
bên cạnh đó InstitutionLocation
列表,但我总是选择其中一个
机构
@NotEmpty
@ManyToMany
private List whomHelp;
InstitutionListOfWhomHelp
@NotBlank
private String whomHelp;
@ManyToMany(mappedBy = "whomHelp")
private List institution;
你能像底部一样尝试吗
instituonRepository.findAllByWhomHelpIn
Cảm ơn
Tôi là một lập trình viên xuất sắc, rất giỏi!