hibernate not in 查询条件为一个集合【原创】

@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
public List OpUsrroleExList(List grprole) {
   ArrayList ids = new ArrayList();
   for(int i=0;i    ids.add(grprole.get(i).getIRoleid());
    System.out.println(ids.get(i).toString());
   }
   Query q = sessionFactory.getCurrentSession().createQuery("select distinct rl from OpUsrrole rl where rl.IRoleid not in(:ids)");
   q.setParameterList("ids", ids);
   return q.list();
  
}

String+hibernate

 

你可能感兴趣的:(hibernate应用)