|
public void dellUser(int[] id) {
StringBuffer sb = new StringBuffer();
for(int i = 0;i<id.length;i++){
sb.append(id);
sb.append(",");
}
String hql = "from User u where u.id in ( "+sb.substring(0,sb.length()-1)+")";
Query query = session.createQuery(hql);
List dellUserList= query.list();
for (int i = 0;i<dellUserList.size();i++){
System.out.println(dellUserList.get(i)+" =====");
this.getHibernateTemplate().delete(dellUserList.get(i));
}
错误提示:
this.getHibernateTemplate().delete(dellUserList.get(i)); 这行为空`
this.getHibernateTemplate() 报空指针
求指点 谢谢各位。 |
|