我正在使用带有postgres数据库和休眠ORM的spring mvc框架。 我遇到了这个错误:
类型的方法参数缺少URI模板变量“ division” 字符串
这是我的控制人
<version>
这是我的DAO
@ResponseBody
@RequestMapping(value = "/ajaxmethod/getdistrict" )
public List<District> getDistrict(@PathVariable("division") String division, Model model){
System.out.println("division::::::::::::::::::::::::::::::::::::::::::" + division );
List<District> districtlist = this.upazillaService.listDistricts(division);
return districtlist;
}
这是我的模特
@SuppressWarnings("unchecked")
@Override
public List<District> listdistricts(String division) {
Session session = this.sessionFactory.getCurrentSession();
Query query = session.createQuery("from District where division_id=:division");
query.setParameter("division", Integer.parseInt(division));
System.out.println( " query::::::::::::::::::::::: " + query.toString());
List<District> districtList = query.list();
for (District p : districtList) {
logger.info("district List::" + p);
}
// session.clear();
return districtList;
}
这是我的jQuery
@ManyToOne
@JoinColumn(name = "division_id", referencedColumnName = "id")
private Division division;
如何避免该错误?