public Object doInHibernate(Session session) throws HibernateException, SQLException { return qb.query(session).list(); } });
public List<Long> doInHibernate(Session session) throws HibernateException, SQLException { org.hibernate.Query q = qb.query(session); return (List<Long>) q.list(); } });
@Transactional(readOnly = true) public Object doWork(org.hibernate.Session session, ServiceFactory sf) { return qb.query(session).uniqueResult(); } });
public Object doInHibernate(Session session) throws HibernateException, SQLException { return qb.query(session).uniqueResult(); } });
@Transactional(readOnly = true) public Object doWork(Session session, ServiceFactory sf) { return qb.query(session).uniqueResult(); } });
public Object doInHibernate(org.hibernate.Session s) throws HibernateException, SQLException { resetReadFilter(s); Query q = qb.query(s); List<Object[]> counts = q.list(); // ticket:1227 - Returning 0 if missing // if (counts.size() != ids.size()) { // throw new ValidationException( // "Missing or protected shares specified"); //} for (Object[] values : counts) { Long shareId = (Long) values[0]; Long count = (Long) values[1]; rv.put(shareId, count); } return null; } });
qb.and("share.active is true"); Query query = qb.query(session); List<Long> shareIds = (List<Long>) query.list();
Query q = qb.query(session); applyParameters(p, q); rv.put(_parentType, q.list());
@Transactional(readOnly = true) public Object doWork(Session session, ServiceFactory sf) { QueryBuilder qb = new QueryBuilder(); qb.select("f"); qb.from("FileAnnotation", "fa"); qb.join("fa.file", "f", false, false); qb.where(); qb.and("fa.id = :id"); qb.param("id", annotationId); OriginalFile file = (OriginalFile) qb.query(session) .uniqueResult(); if (file == null) { throw new ome.conditions.ApiUsageException("No such file annotation: " + annotationId); } return file.getId(); } }) {
protected IObject get(Session session, Class type, long id) { QueryBuilder qb = new QueryBuilder(); qb.select("this").from(type.getName(), "this"); if (IAnnotated.class.isAssignableFrom(type)) { qb.join("this.annotationLinks", "l1", true, true); qb.join("l1.child", "a1", true, true); qb.join("a1.annotationLinks", "l2", true, true); qb.join("l2.child", "a2", true, true); } if (!IGlobal.class.isAssignableFrom(type)) { if (IMutable.class.isAssignableFrom(type)) { qb.join("this.details.updateEvent", "update", false, true); } qb.join("this.details.creationEvent", "create", false, true); qb.join("this.details.owner", "owner", false, true); qb.join("this.details.group", "group", false, true); } qb.where().and("this.id = :id"); qb.param("id", id); return (IObject) qb.query(session).uniqueResult(); } }
Query q = qb.query(session); applyParameters(pWithDefaults, q); List<Image> images = (List<Image>) q.list();
Query q = qb.query(_s); applyParameters(parameters, q);
return qb.query(session).list();
Query query = qb.query(session);
@Transactional(readOnly = true) public Object doWork(Session session, ServiceFactory sf) { QueryBuilder qb = new QueryBuilder(); qb.select("distinct fa"); qb.from("Image", "i"); qb.append(", Roi roi "); qb.join("roi.annotationLinks", "rlinks", false, false); qb.join("rlinks.child", "rfa", false, false); qb.join("i.wellSamples", "ws", false, false); qb.join("ws.well", "well", false, false); qb.join("well.plate", "plate", false, false); qb.join("plate.annotationLinks", "links", false, false); qb.join("links.child", "fa", false, false); qb.where(); qb.and("fa.ns = '" + NSMEASUREMENT.value + "'"); qb.and("rfa.id = fa.id"); qb.and("i.id = :id"); qb.and("i.id = roi.image"); qb.param("id", imageId); qb.filter("fa", filter(opts)); return qb.query(session).list(); } }));
"Name and id are both null for group query."); setQuery(qb.query(session));
org.hibernate.Query q = qb.query(session); setQuery(q);
setQuery(qb.query(session));