大家好。我遇到了一个问题,我实现了 xPayService.getJobAutocomplete("searchValue");
并且我的数据已停止显示在我的前端。任何人都可以检查发生了什么来帮助我修复它。谢谢
这是我的java代码:
// this is in different class
public void loadSearchList() throws SQLException, NamingException, URISyntaxException, IOException, ParseException {
List<JobSearchItem> jobSearchList = xPayService.getJobAutocomplete("searchValue");
this.setJobSearchItems(jobSearchList);
}
// this is into another class too.
public List<JobSearchItem> getJobAutocomplete(String searchValue) {
String sValue = "%" + searchValue.toUpperCase() + "%";
return dataUtilityService.getJdbcTemplate().query(SQL_GET_AUTOCOMPLETE,
new Object[]{sValue, sValue}, jobSearchItemMapper);
}
最佳答案
请注意,问题稍后会更新,所以现在这是部分答案
getJobAutocomplete
需要一个参数,但您没有传递它,这就是您收到错误的原因。
在下面的行中用 your_serach_string
替换您的字符串搜索值,它应该可以工作
List<JobSearchItem> jobSearchList =xPayService.getJobAutocomplete("search_string");
更新
在下面的代码中,您应该传递您的查询字符串。例如,如果您想搜索苹果,那么您应该在下面的代码中传递苹果。
String search = "apple"
List<JobSearchItem> jobSearchList = xPayService.getJobAutocomplete(search);
this.setJobSearchItems(jobSearchList);
关于java - 如何修复未使用 sql 查询/java 显示的数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54597488/