当前位置: 代码迷 >> PB >> hibernate 执行此条delete Lc_Admin where id in(?)只得删除第一个ID
  详细解决方案

hibernate 执行此条delete Lc_Admin where id in(?)只得删除第一个ID

热度:266   发布时间:2016-04-29 05:13:52.0
hibernate 执行此条delete Lc_Admin where id in(?)只能删除第一个ID

    ?public boolean runByHql(String hql, Object...params) {
    try {
    Query query = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createQuery(hql);
    if(params != null && params.length>0){
    for(int i=0;i<params.length;i++){
    query.setString(i, params[i].toString());
    }
    }
    query.executeUpdate();
    return true;
    } catch (Exception e) {
    e.printStackTrace();
    return false;
    }
    }

    ?String hql = "delete Lc_Admin where id in(?)";

    为什么执行此条hql语句时,能执行成功。但是删除多个id时[1,2,3],只能执行成功一个id的数据[1]!!!

------解决思路----------------------
发到java版块吧,这个版块是pb的
  相关解决方案