private void ids(Criteria criteria, QueryBuilder qb, String path) { if (values.onlyIds != null) { if (criteria != null) { criteria.add(Restrictions.in("id", values.onlyIds)); } if (qb != null) { String unique = qb.unique_alias("ids"); qb.and(String.format("%sid in (:%s) ", path, unique)); qb.paramList(unique, values.onlyIds); } } }
public void params(Parameters params2) { if (params2 != null) { for (String key : params2.keySet()) { Object o = params2.get(key).value; if (o instanceof Collection) { paramList(key, (Collection) o); } else { param(key, o); } } } }
qb.where(); qb.and("share.id in (:ids)"); qb.paramList("ids", ids); qb.and("comment.ns like :ns"); qb.param("ns", NS_COMMENT + "%");
public Object call() throws Exception { final QueryBuilder qb = new QueryBuilder(); qb.select("o").from("OriginalFile", "o"); if (!parseAcceptsList(qb, acceptsList)) { long gid = factory.sessionManager .getEventContext(factory.principal) .getCurrentGroupId(); qb.and("o.details.group.id = " + gid); } List<Long> officialIds = scripts.idsInDb(); if (officialIds != null && officialIds.size() > 0) { qb.and("o.id not in (:ids) "); qb.paramList("ids", officialIds); } List<OriginalFile> files = (List<OriginalFile>) factory.executor.execute(__current.ctx, factory.principal, new Executor.SimpleWork(this, "getUserScripts") { @Transactional(readOnly = true) public Object doWork(Session session, ServiceFactory sf) { return qb.query(session).list(); } }); IceMapper mapper = new IceMapper(); return mapper.map(files); } });
qb.join("links2.parent","share2", false, false); qb.where(); qb.paramList("ids", shareIds); qb.and("share2.id in (:ids) and share2.id in ");
qb.paramList("ids", ids); org.hibernate.Query q = qb.query(session); setQuery(q);