segunda-feira, 7 de março de 2016

Hibernate: Not In no Criteria


Criteria criteria = ...; // obtain criteria from somewhere, like session.createCriteria() 
criteria.add(
  Restrictions.not(
     // replace "id" below with property name, depending on what you're filtering against
    Restrictions.in("id", new long[] {2, 3})
  )
);

Fonte: http://stackoverflow.com/questions/1220901/how-to-achieve-not-in-by-using-restrictions-and-criteria-in-hibernate

Nenhum comentário:

Postar um comentário