SHARE
TWEET

Untitled

a guest Mar 12th, 2012 52 Never
  1. Long[] IDs = {1L, 2L, 3L};
  2. QueryBuilder qb = session.getQueryBuilder();
  3. QueryDomainType<SomeTable> dobj = qb.createQueryDefinition(SomeTable.class);
  4. PredicateOperand field = dobj.get("id");
  5. PredicateOperand values = dobj.param("param");
  6. Predicate predicate = field.in(values);
  7. dobj.where(predicate);
  8. Query<SomeTable> query = session.createQuery(dobj);
  9. query.setParameter("param", IDs);
  10. List<SomeTable> results = query.getResultList();
RAW Paste Data
Top