数据库删除多条数据

public int clearAllPartsByKey(List keys,User user) {
System.out.println("keys::"+keys);
List ids = keys;
Session session=sessionFactory.getCurrentSession();
String hql = "delete from Part where id in (:ids)";//+id;
Query query = session.createQuery(hql);
query.setParameter("ids", ids); //一条数据
query.setParameterList("ids", ids); //多条数据
int result = query.executeUpdate();
return result;
}

你可能感兴趣的:(数据库删除多条数据)