sql问题-java.sql.SQLException:操作数应包含1列(一次)

sql问题-java.sql.SQLException:操作数应包含1列(一次),java,mysql,hibernate,jpa,spring-data,Java,Mysql,Hibernate,Jpa,Spring Data,我使用Spring数据在MySql数据库上执行select操作 我试图通过listOfWhomHelp获取所有机构。 我希望所有记录(institutions)都包含listOfWhomHelp,但如果我在listOfWhomHelp中选择多个元素,它会抛出我: java.sql.SQLException: Operand should contain 1 column(s) com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963

我使用Spring数据在MySql数据库上执行select操作

我试图通过
listOfWhomHelp
获取所有机构。 我希望所有记录(
institutions
)都包含
listOfWhomHelp
,但如果我在
listOfWhomHelp
中选择多个元素,它会抛出我:

java.sql.SQLException: Operand should contain 1 column(s)
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:963)  
存储库方法

卫生服务机构名单

@NotBlank
私人字符串whomHelp;
@许多人(mappedBy=“whomHelp”)
私人上市机构;

你能试一下吗

instituonRepository.findAllByWhomHelpIn

谢谢

你不认为它应该使用
比如'if(!institution.getWhomHelp().isEmpty()){return institutionRepository.findAllByWhomHelp(institution.getWhomHelp());}`你可以检查或。但问题是,
institution.getWhomHelp()
不是空的-我以前检查过这个。这是当list
institution.getInstitutionLocations()
是空的而
whomHelp
不是空的时候的方式。我还处理了NullPointerException
public List<Institution> findInstitutions(Institution institution) throws NullPointerException {

    if(institution.getInstitutionLocations().isEmpty()){
        return institutionRepository.findAllByWhomHelp(institution.getWhomHelp());
    }
}
@NotEmpty
@ManyToMany
private List<InstitutionListOfWhomHelp> whomHelp;
@NotBlank
private String whomHelp;

@ManyToMany(mappedBy = "whomHelp")
private List<Institution> institution;
instituonRepository.findAllByWhomHelpIn