网上搜集到的,先记录下来以备以后整理
方法一:
@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
public List<OpUsrrole> OpUsrroleExList(List<OpUsrrole> grprole) {
ArrayList<Long> ids = new ArrayList<Long>();
for(int i=0;i<grprole.size();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();
}
方法二:
方法一:
@Transactional(propagation=Propagation.NOT_SUPPORTED,readOnly=true)
public List<OpUsrrole> OpUsrroleExList(List<OpUsrrole> grprole) {
ArrayList<Long> ids = new ArrayList<Long>();
for(int i=0;i<grprole.size();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();
}
方法二:
- public ArrayList<T> EmptyBaia(){ ??
- ????????DetachedCriteria subconsulta = DetachedCriteria.forClass(Usuarios.class).setProjection(Property.forName("baia")); ??
- ????????ArrayList<T> baia = (ArrayList<T>) this.session.createCriteria(this.classe).add(Property.forName("numero").notIn(subconsulta)).list(); ??
- ????????return baia; ??
- ????}?