this.getHibernateTemplate().find(hql, new Object[]{parent_id});参数设置的问题
publicArrayList<Area>findAllArea(intparent_id){Stringhql="fromAreaareawherearea.paren...
public ArrayList<Area> findAllArea(int parent_id) {
String hql = "from Area area where area.parent_id=?";
List<Area> areaList = null;
System.out.println(hql);
areaList = (ArrayList<Area>) this.getHibernateTemplate().find(hql,
new Integer[] { parent_id });
this.getHibernateTemplate().find(hql, new Object[]{parent_id});
areaList = this.getHibernateTemplate().find(hql);
return (ArrayList<Area>) areaList;
}
报错为:
org.springframework.orm.hibernate3.HibernateQueryException: Expected positional parameter count: 1, actual parameters: [] [from Area area where area.parent_id=?]; nested exception is org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [] [from Area area where area.parent_id=?] 展开
String hql = "from Area area where area.parent_id=?";
List<Area> areaList = null;
System.out.println(hql);
areaList = (ArrayList<Area>) this.getHibernateTemplate().find(hql,
new Integer[] { parent_id });
this.getHibernateTemplate().find(hql, new Object[]{parent_id});
areaList = this.getHibernateTemplate().find(hql);
return (ArrayList<Area>) areaList;
}
报错为:
org.springframework.orm.hibernate3.HibernateQueryException: Expected positional parameter count: 1, actual parameters: [] [from Area area where area.parent_id=?]; nested exception is org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [] [from Area area where area.parent_id=?] 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询