List of usage examples for org.hibernate Query setEntity
@Deprecated @SuppressWarnings("unchecked") Query<R> setEntity(String name, Object val);
From source file:net.webpasswordsafe.server.dao.PasswordDAOHibernate.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public List<Password> findPasswordsByPermissionSubject(Subject subject) { Query hqlQuery = getSession() .createQuery("select distinct p from Password p join p.permissions pm where pm.subject = :subject"); hqlQuery.setEntity("subject", subject); return hqlQuery.list(); }
From source file:net.webpasswordsafe.server.dao.TagDAOHibernate.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public List<Tag> findTagsByUser(User user) { Query hqlQuery = getSession().createQuery( "select distinct t from Tag t join t.passwords p join p.permissions pm where ((pm.subject = :user) or (pm.subject in (select g from Group g join g.users u where u = :user))) order by t.name asc"); hqlQuery.setEntity("user", user); return hqlQuery.list(); }
From source file:net.webpasswordsafe.server.dao.TemplateDAOHibernate.java
License:Open Source License
@Override @SuppressWarnings("unchecked") public List<Template> findTemplatesByDetailSubject(Subject subject) { Query hqlQuery = getSession().createQuery( "select distinct t from Template t join t.templateDetails td where td.subject = :subject"); hqlQuery.setEntity("subject", subject); return hqlQuery.list(); }
From source file:org.apache.ode.daohib.bpel.CorrelatorDaoImpl.java
License:Apache License
public boolean checkRoute(CorrelationKeySet correlationKeySet) { entering("CorrelatorDaoImpl.checkRoute"); Query q = getSession().getNamedQuery(HCorrelatorSelector.SELECT_MESSAGE_ROUTE); q.setEntity("corr", _hobj); q.setString("ckey", correlationKeySet.toCanonicalString()); q.setReadOnly(true);/* ww w. jav a 2 s . co m*/ return q.list().isEmpty(); }
From source file:org.apache.ode.daohib.bpel.CorrelatorDaoImpl.java
License:Apache License
public void removeRoutes(String routeGroupId, ProcessInstanceDAO target) { entering("CorrelatorDaoImpl.removeRoutes"); String hdr = "removeRoutes(" + routeGroupId + ", iid=" + target.getInstanceId() + "): "; __log.debug(hdr);// w ww .j a v a2 s . c om Session session = getSession(); Query q = session.createQuery(QRY_DELSELECTORS); q.setString(0, routeGroupId); // groupId q.setEntity(1, ((ProcessInstanceDaoImpl) target).getHibernateObj()); // instance int updates = q.executeUpdate(); session.flush(); // explicit flush to ensure route removed if (__log.isDebugEnabled()) __log.debug(hdr + "deleted " + updates + " rows"); }
From source file:org.apache.ode.daohib.bpel.ProcessInstanceDaoImpl.java
License:Apache License
protected void clearSelectors() { entering("ProcessInstanceDaoImpl.clearSelectors"); Query q = getSession().createQuery(QRY_DELSELECTORS); q.setEntity(0, _instance); q.executeUpdate();//from w ww. ja va2 s . c o m }
From source file:org.apache.ode.daohib.bpel.ScopeDaoImpl.java
License:Apache License
public PartnerLinkDAO getPartnerLink(int plinkId) { entering("ScopeDaoImpl.getPartnerLink"); Query qry = getSession().createQuery(QRY_SCOPE_EPR); qry.setInteger(0, plinkId);/* ww w . j ava2 s . c om*/ qry.setEntity(1, _scope); HPartnerLink hpl = (HPartnerLink) qry.uniqueResult(); if (hpl == null) return null; return new PartnerLinkDAOImpl(_sm, hpl); }
From source file:org.apache.ode.daohib.bpel.ScopeDaoImpl.java
License:Apache License
@SuppressWarnings("unchecked") public Collection<ScopeDAO> getChildScopes() { entering("ScopeDaoImpl.getChildScopes"); Query q = getSession().createQuery("from " + HScope.class.getName() + " as x where x.parentScope=?"); q.setEntity(0, _scope); Collection<HScope> hscopes = q.list(); return CollectionsX.transform(new LinkedList<ScopeDAO>(), hscopes, new UnaryFunction<HScope, ScopeDAO>() { public ScopeDAO apply(HScope x) { return new ScopeDaoImpl(_sm, x); }// w w w .java2 s . co m }); }
From source file:org.apache.ode.daohib.bpel.ScopeDaoImpl.java
License:Apache License
@SuppressWarnings("unchecked") public Collection<XmlDataDAO> getVariables() { entering("ScopeDaoImpl.getVariables"); Query q = getSession().createFilter(_scope.getVariables(), "where this.scope=?"); q.setEntity(0, _scope); return CollectionsX.transform(new LinkedList<XmlDataDAO>(), (Collection<HXmlData>) q.list(), new UnaryFunction<HXmlData, XmlDataDAO>() { public XmlDataDAO apply(HXmlData x) { return new XmlDataDaoImpl(_sm, x); }/*from w w w . j a va 2 s . co m*/ }); }
From source file:org.bedework.dumprestore.restore.HibRestore.java
@Override public boolean eventNameExists(final BwCalendar cal, final String name) throws Throwable { openHibSess();//from w w w .j a v a2 s .c o m Query q = hibSess.createQuery("select ev.name from " + BwEventObj.class.getName() + " ev where ev.calendar=:cal " + " and ev.name=:name "); q.setEntity("cal", cal); q.setString("name", name); Collection c = q.list(); return (c != null) && !c.isEmpty(); }