posts - 496,comments - 227,trackbacks - 0
网上搜集到的,先记录下来以备以后整理

方法一:
@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();

}

方法二:
  1. public ArrayList<T> EmptyBaia(){   
  2.         DetachedCriteria subconsulta = DetachedCriteria.forClass(Usuarios.class).setProjection(Property.forName("baia"));   
  3.         ArrayList<T> baia = (ArrayList<T>) this.session.createCriteria(this.classe).add(Property.forName("numero").notIn(subconsulta)).list();   
  4.         return baia;   
  5.     } 
posted on 2011-06-02 09:23 SIMONE 阅读(2910) 评论(0)  编辑  收藏 所属分类: JAVA

只有注册用户登录后才能发表评论。


网站导航: